Broker API HubMenu

Open positions: broker API endpoints compared

22 documented calls from 11 of the 12 APIs with endpoint records here, and 8 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 position is what you currently hold in a market: the direction, the size and the level it was opened at. Reading open positions is how a program learns its real exposure, as opposed to what it believes it holds.

Some APIs report one entry per deal, others net every deal in an instrument into a single entry, and some offer both views. Check which view a call returns before you add sizes together.

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
Capital.comGET/api/v1/positionsAll open positions on the active account, each with position and market details.open-api.capital.comchecked
Capital.comGET/api/v1/positions/{dealId}One open position by its dealId.open-api.capital.comchecked
DXtrade APIsGET/accounts/{accountCode}/positionsList every open position on an account.demo.dx.tradechecked
eToroGET/api/v1/trading/info/demo/pnlReturns the demo account's credit, unrealised profit or loss, open positions, pending orders and copy relationships.api-portal.etoro.comchecked
eToroGET/api/v1/trading/info/real/pnlReturns the real account's credit, unrealised profit or loss, open positions, pending orders and copy relationships.api-portal.etoro.comchecked
IGGET/positionsAll open positions on the active account, each with its market snapshot.labs.ig.comchecked
IGGET/positions/{dealId}A single open position by deal ID.labs.ig.comchecked
Interactive BrokersGET/portfolio/{accountId}/positions/{pageId}All positions in an account, one page at a time, with size, market price, market value and unrealised profit and loss.interactivebrokers.comchecked
Match-Trader Platform APIGET/mtr-api/{SYSTEM_UUID}/open-positionsList every open position on the trading account, with its side, volume, open price, stop loss, take profit and running profit.app.theneo.iochecked
MetaApiGET/users/current/accounts/{accountId}/positionsList the open positions on the MetaTrader account.metaapi.cloudchecked
MetaApiGET/users/current/accounts/{accountId}/positions/{positionId}Read one open position by its id, the ticket number.metaapi.cloudchecked
OANDAGET/v3/accounts/{accountID}/openPositionsPositions with open trades, netted per instrument with long and short sides.developer.oanda.comchecked
OANDAGET/v3/accounts/{accountID}/openTradesAll open trades on the account.developer.oanda.comchecked
OANDAGET/v3/accounts/{accountID}/positionsEvery position the account has ever held, one per instrument, including those now flat. For open positions only there is a separate call.developer.oanda.comchecked
OANDAGET/v3/accounts/{accountID}/positions/{instrument}The position in one instrument on the account, whether it is open or not.developer.oanda.comchecked
OANDAGET/v3/accounts/{accountID}/tradesTrades on the account, filtered by state, instrument or ID. Open trades are returned unless you ask for another state.developer.oanda.comchecked
Saxo OpenAPIGET/port/v1/netpositions/meLists positions netted per instrument for the logged in client, with average open price and profit or loss. Add SubPositions to FieldGroups to include the underlying positions.developer.saxochecked
Saxo OpenAPIGET/port/v1/positionsLists open positions for a client, an account group, an account or one net position, chosen by query parameters.developer.saxochecked
Saxo OpenAPIGET/port/v1/positions/{PositionId}One open position by its id, with opening details in PositionBase and the live view in PositionView.developer.saxochecked
Saxo OpenAPIGET/port/v1/positions/meLists each open position for the logged in client, with opening details in PositionBase and live price and profit or loss in PositionView.developer.saxochecked
TradeLocker APIGET/trade/accounts/{accountId}/positionsList every position currently open on the account.public-api.tradelocker.comchecked
Trading 212GET/api/v0/equity/positionsEvery open position on the account, with quantity, average price paid, current price and the effect on the account in its own currency.docs.trading212.comchecked

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 APImessageProtoOAReconcileReq cTrader Open APIAsks for the account's open positions and pending orders as they stand now.help.ctrader.comchecked
Derivmessageportfolio Deriv WebSocket APILists the contracts the account holds open now. It is a single answer, not a stream.developers.deriv.comchecked
Derivmessageproposal_open_contract Deriv WebSocket APIReturns the current price and state of a contract the account holds. With subscribe set to 1 an update follows each time it changes, and with no contract_id the stream covers every open contract.developers.deriv.comchecked
MetaTrader 4 (MQL4)functionOrderSelect() MQL4Selects one order, by its place in a list or by its ticket, so that the functions which read an order's properties read that one.docs.mql4.comchecked
MetaTrader 4 (MQL4)functionOrdersTotal() MQL4Returns how many market and pending orders the account has.docs.mql4.comchecked
MetaTrader 5 (Python package and MQL5)functionpositions_get() MetaTrader5 Python packageReturns the open positions on the account: all of them, those in one symbol, those whose symbol matches a filter, or the one with a given ticket.mql5.comchecked
MetaTrader 5 (Python package and MQL5)functionPositionGetTicket() MQL5Returns the ticket of the open position at an index in the list of positions, and selects that position so its properties can be read.mql5.comchecked
MetaTrader 5 (Python package and MQL5)functionPositionsTotal() MQL5Returns how many positions are open on the account.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