Broker API HubMenu

Preview an order before sending it: broker API endpoints compared

8 documented calls from 5 of the 12 APIs with endpoint records here, and 7 functions and messages from 4 APIs whose interfaces are not HTTP, each with the page it was read on.

Independent and unofficialNewest check

Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.

What this task is

A preview call takes the same ticket as an order and answers with what would happen: the expected cost, the margin it would use and any warning, without sending anything to the market.

A preview is a projection at one moment. Prices and margin rates move, so the order you then send can still be rejected or filled at a different level.

The documented endpoint, API by API

Ordered by the name of the broker or platform API, then by path. The order is not a ranking. Open a row for the parameters, the response and a sample request.

Broker or platformEndpointWhat the record says it doesSource
eToroPOST/api/v2/trading/info/costsWorks out the costs a proposed real account order would carry if it were executed now: markup, spread, transaction fee, overnight and weekend fees and tax. Nothing is traded.api-portal.etoro.comchecked
eToroPOST/api/v2/trading/info/demo/costsWorks out the costs a proposed demo account order would carry if it were executed now: markup, spread, transaction fee, overnight and weekend fees and tax. Nothing is traded.api-portal.etoro.comchecked
IGPOST/indicativecostsandcharges/closeAsk for an indicative breakdown of the costs and charges of closing an open deal. Nothing is traded.labs.ig.comchecked
IGPOST/indicativecostsandcharges/editAsk for an indicative breakdown of the costs and charges of editing an order, split into its stop and its limit. Nothing is traded.labs.ig.comchecked
IGPOST/indicativecostsandcharges/openAsk for an indicative breakdown of the costs and charges of opening a deal: spread, commission, funding and currency conversion. Nothing is traded.labs.ig.comchecked
Interactive BrokersPOST/iserver/account/{accountId}/orders/whatifProjects the effect of an order before you send it: cost, change to equity, initial and maintenance margin, and position.interactivebrokers.comchecked
MetaApiPOST/users/current/accounts/{accountId}/calculate-marginWork out the margin that opening a given trade on the account would need, without placing it.metaapi.cloudchecked
Saxo OpenAPIPOST/trade/v2/orders/precheckChecks an order without placing it and returns the expected costs, cash required and margin impact. Useful to show a cost preview before the user confirms.developer.saxochecked

The same task where the interface is not HTTP

Some platform APIs, and the streaming interfaces of some broker APIs, are not sent as HTTP requests. A function is called from a program in its language, and a message is sent over an open connection. None has a method or a path, so each row is labelled with its kind and its interface. A record is put on this page by hand, from what the vendor's page says the call does, and one call can do several jobs, so the same function can be on more than one task page. Ordered by the name of the broker or platform API, then interface, then name.

APICallWhat the record says it doesSource
cTrader Open APImessageProtoOAExpectedMarginReq cTrader Open APIAsks for an estimate of the margin a trade would need under the account's leverage profile, which the definition says can be done before a new order is sent.help.ctrader.comchecked
Derivmessageproposal Deriv WebSocket APIAsks what one contract would cost now: the price, the payout and a description of it, with an id that buy accepts. With subscribe set to 1 the price is sent again as it changes.developers.deriv.comchecked
MetaTrader 4 (MQL4)functionAccountFreeMarginCheck() MQL4Returns the free margin that would be left after opening an order of a given symbol, direction and size at the current price.docs.mql4.comchecked
MetaTrader 5 (Python package and MQL5)functionorder_calc_margin() MetaTrader5 Python packageWorks out the margin, in the account's currency, that a trade of a given type, symbol, volume and price would need.mql5.comchecked
MetaTrader 5 (Python package and MQL5)functionorder_check() MetaTrader5 Python packageChecks whether the account has the funds for a trade request without sending it, and returns what the balance, equity and margin would be.mql5.comchecked
MetaTrader 5 (Python package and MQL5)functionOrderCalcMargin() MQL5Works out the margin, in the account's currency, that an order of a given type, symbol, volume and price would need on the account as it stands.mql5.comchecked
MetaTrader 5 (Python package and MQL5)functionOrderCheck() MQL5Checks whether there is enough money for a trade request without sending it, and writes what the account would look like into a result structure.mql5.comchecked

None documented here yet

These APIs have endpoint records on this site, but none is assigned to this task. That describes this dataset. It is not a statement that the API lacks such a call.

Brokers and platforms with no endpoint records at all are not listed above. The broker directory shows what is recorded for each.

Sections