Skip to main content

WEBSOCKET API Trading - Get open positions

WEBSOCKET API Trading - Get open positions

Written by Albert
Updated over a week ago

Get open positions

Connection

URL:

/frontoffice/ws/v4/account?access_token={YOUR_ACCESS_TOKEN}

arguments array

The connection parameters.

In the first element, provide the accountId as a string.

invocationId string

The invocation identifier.

Must be unique and increase by 1 for each sent message.

target string

The stream name.

Specify "OpenPositions".

type int

The operation type.

Set to 4 to indicate a subscription to the stream.

Example:

{
"arguments": [
"67d0456f8c7b1108e4cf5d46"
],
"invocationId": "0",
"target": "OpenPositions",
"type": 4
}

Message

type string

The operation type.

2 indicates the streaming is in progress.

invocationId string

The invocation identifier. Same as in the request.

item object

The dataset object.

item.item array of objects

The array of position objects.

item.item.positionId string

The unique identifier of the position assigned by the system.

item.item.marketId string

The market identifier, in the following format: {marketType}.{baseAssetId}_{quoteAssetId}, for example: cfd.eth_eur.

item.item.marketType string

The market type.

Possible values:

  • Spot

  • Cfd

  • Perp

item.item.marketDisplayName string

The market ticker.

item.item.marketFullName string

The market full name or description (optional).

item.item.createdAt dateTime

The timestamp when the position was opened, in ISO 8601 format.

item.item.updatedAt dateTime

The timestamp of the most recent update to the position, in ISO 8601 format.

item.item.side string

The position side. Possible values:

  • Buy

  • Sell

item.item.status string

The current position status. Always "Open".

item.item.leverage int

Applicable only to CFD markets.

The leverage ratio used when opening the position.

item.item.positionLotAmount decimal string

The position volume, in lots.

item.item.positionPriceInRAT decimal string

The current position price, in conversion to RAT.

item.item.rateToRAT decimal string

The current exchange rate of a quote asset to RAT.

item.item.usedMarginInRAT decimal string

The amount of trader’s funds used for maintaining a position, in conversion to RAT.

item.item.openPrice decimal string

The volume-weighted average price (VWAP) at which the position was opened.

item.item.currentMarketPrice decimal string

The current market price of the base asset: bid for Long positions and ask for Short positions.

item.item.unrealizedPnlDayInRAT decimal string

The potential profit or loss earned for a current day, in conversion to RAT.

For Long positions, this value is calculated as Position size × (Current bid priceFirst bid price for today).

For Short positions, this value is calculated as Position size × (First ask price for todayCurrent ask price).

If a position was opened today, then the Open VWAP is used instead of the First price for today.

item.item.unrealizedPnlDayPercent decimal string

The potential profit or loss earned for a current day, in percents.

item.item.unrealizedPnlTotalInRAT decimal string

The potential profit or loss earned for the entire period from the moment the position was opened, in conversion to RAT.

For Long positions, this value is calculated as Position size × (Current bid priceOpen VWAP).

For Short positions, this value is calculated as Position size × (Open VWAPCurrent ask price).

item.item.unrealizedPnlTotalPercent decimal string

The potential profit or loss earned for the entire period from the moment the position was opened, in conversion to RAT, in percents.

item.item.takeProfit decimal string

The Take Profit price, if set.

item.item.stopLoss decimal string

The Stop Loss price, if set.

item.item.positionModifier string

The reason for the latest position update.

snapshot boolean

The data snapshot.

If snapshot: true, it indicates the message contains the full dataset. Subsequent messages with snapshot: false only include updates or changes since the initial snapshot.

Example:

{
"type": 2,
"invocationId": "0",
"item": {
"item": [
{
"positionId": "01JP4H3AMS7Q1H6Y6H3XJ52JTA",
"marketId": "cfd.eur_chf",
"marketType": "Cfd",
"marketDisplayName": "EUR/CHF",
"marketFullName": "",
"createdAt": "2025-03-12T06:36:31.257Z",
"updatedAt": "2025-03-12T06:36:31.257Z",
"side": "Buy",
"status": "Open",
"leverage": 1,
"positionLotAmount": "0.01",
"positionPriceInRAT": "1000.46",
"rateToRAT": "1.07",
"usedMarginInRAT": "1000.53",
"openPrice": "0.96304",
"currentMarketPrice": "0.93501",
"unrealizedPnlDayInRAT": "1.86",
"unrealizedPnlDayPercent": "0.0018",
"unrealizedPnlTotalInRAT": "-29.93",
"unrealizedPnlTotalPercent": "-0.0291",
"takeProfit": null,
"stopLoss": null,
"positionModifier": "Trader"
},
{
"positionId": "01JVQB9ZWJ6G4QV0P98X0QWNA7",
"marketId": "cfd.eur_chf",
"marketType": "Cfd",
"marketDisplayName": "EUR/CHF",
"marketFullName": "",
"createdAt": "2025-05-20T17:19:21.49Z",
"updatedAt": "2025-05-20T17:19:21.491321Z",
"side": "Buy",
"status": "Open",
"leverage": 100,
"positionLotAmount": "0.1",
"positionPriceInRAT": "10004.6",
"rateToRAT": "1.07",
"usedMarginInRAT": "100.06",
"openPrice": "0.93666",
"currentMarketPrice": "0.93501",
"unrealizedPnlDayInRAT": "18.61",
"unrealizedPnlDayPercent": "0.0018",
"unrealizedPnlTotalInRAT": "-17.02",
"unrealizedPnlTotalPercent": "-0.0017",
"takeProfit": null,
"stopLoss": null,
"positionModifier": "Trader"
}
],
"snapshot": false
}
}

Did this answer your question?