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.
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 platform | Endpoint | What the record says it does | Source |
|---|---|---|---|
| eToro | POST/api/v2/trading/info/costs | Works 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 |
| eToro | POST/api/v2/trading/info/demo/costs | Works 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 |
| IG | POST/indicativecostsandcharges/close | Ask for an indicative breakdown of the costs and charges of closing an open deal. Nothing is traded. | labs.ig.comchecked |
| IG | POST/indicativecostsandcharges/edit | Ask 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 |
| IG | POST/indicativecostsandcharges/open | Ask 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 Brokers | POST/iserver/account/{accountId}/orders/whatif | Projects the effect of an order before you send it: cost, change to equity, initial and maintenance margin, and position. | interactivebrokers.comchecked |
| MetaApi | POST/users/current/accounts/{accountId}/calculate-margin | Work out the margin that opening a given trade on the account would need, without placing it. | metaapi.cloudchecked |
| Saxo OpenAPI | POST/trade/v2/orders/precheck | Checks 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.
| API | Call | What the record says it does | Source |
|---|---|---|---|
| cTrader Open API | messageProtoOAExpectedMarginReq cTrader Open API | Asks 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 |
| Deriv | messageproposal Deriv WebSocket API | Asks 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() MQL4 | Returns 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 package | Works 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 package | Checks 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() MQL5 | Works 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() MQL5 | Checks 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.
- Capital.com: none documented here yet
- Deriv: none documented here yet
- OANDA: none documented here yet
- Trading 212: none documented here yet
- DXtrade APIs: none documented here yet
- Match-Trader Platform API: none documented here yet
- TradeLocker API: none documented here yet
Brokers and platforms with no endpoint records at all are not listed above. The broker directory shows what is recorded for each.