Portfolio positions
The request cannot be executed anonymously. The required token parameter must contain an up-to-date Access Token.
This operation can be performed with request to HTTP API.
The request creates a subscription to information about positions of financial and currency assets in the specified portfolio.
Request
To create a subscription to a data channel, send a message to the established WebSocket connection with a request body containing the details of the subscription to be created.
- Request body
- Schema
{
"opcode": "PositionsGetAndSubscribeV2",
"exchange": "ITS",
"portfolio": "D00013",
"skipHistory": false,
"format": "Simple",
"guid": "c328fcf1-e495-408a-a0ed-e20f95d6b813",
"token": "eyJhbGciOiJ..."
}
Request body parameters
OrderBookGetAndSubscribe— Subscription to order bookBarsGetAndSubscribe— Subscription to price history (candlesticks)QuotesSubscribe— Subscription to quotesInstrumentsGetAndSubscribeV2— Subscription to security information updates on the selected exchangeAllTradesGetAndSubscribe— Subscribe to all tradesPositionsGetAndSubscribeV2— Subscription to information about current positions on securities and moneySummariesGetAndSubscribeV2— Subscription to portfolio summary informationRisksGetAndSubscribe— Subscription to consolidated information on portfolio risksTradesGetAndSubscribeV2— Subscription for information on tradesOrdersGetAndSubscribeV2— Subscription to information about current orders on the market for the selected exchange and securityStopOrdersGetAndSubscribeV2— Subscription to information about current conditional orders in the market for the selected exchange and securityunsubscribe— Cancelation of previously created subscriptiontrue— display only new datafalse— display including historical dataSimpleis the original data format. Supports legacy (deprecated) parameters to ensure backward compatibilitySlimis the lightweight data format for fast messaging. Does not support legacy (deprecated) parametersHeavyis the complete data format, evolving and augmented with new fields. Does not support legacy (deprecated) parameters
Operation code:
Exchange code
Example: ITS
Client portfolio ID
Example: D00013
Flag for filtering out historical data:
Example: false
The format of the JSON object returned by the server:
Example: Simple
The unique identifier of the operation. All incoming messages related to this operation will have this guid field value
Example: c328fcf1-e495-408a-a0ed-e20f95d6b813
Access Token
Example: eyJhbGciOiJ...
Responses
The content of the response returned to the WebSocket connection depends on the results of processing the request:
- If the request is processed successfully, the server will send one
200code message in response, confirming that the subscription has been created, after which it will begin transmitting100code messages containing the information requested as part of the subscription. - If the request processing failed, the server will send back one message with an error code corresponding to the reason for the failure, after which it will close the WebSocket connection.
- 100
- 200
- 401
Messages from the channel containing the requested information
- Simple
- Slim
- Heavy
- Response body
- Schema
{
"data": {
"volume": 4900,
"currentVolume": 4962.5,
"symbol": "AAPL",
"brokerSymbol": "ITS:AAPL",
"portfolio": "D00013",
"exchange": "ITS",
"avgPrice": 196,
"qtyUnits": 25,
"openUnits": 25,
"lotSize": 1,
"shortName": "Apple Inc.",
"qtyT0": 25,
"qtyT1": 25,
"qtyT2": 25,
"qtyTFuture": 25,
"qtyT0Batch": 25,
"qtyT1Batch": 25,
"qtyT2Batch": 25,
"qtyTFutureBatch": 25,
"qtyBatch": 25,
"openQtyBatch": 25,
"qty": 25,
"open": 25,
"dailyUnrealisedPl": 30,
"unrealisedPl": 62.5,
"isCurrency": false,
"existing": true
},
"guid": "c328fcf1-e495-408a-a0ed-e20f95d6b813"
}
Response body parameters
data
object
Requested data
Position volume in settlement currency, based on the medium lot price (avgPrice|pxavg)
Example: 1702.10
Position volume in settlement currency, based on the current lot price
Example: 1603.20
Security code (ticker)
Example: SOGN
Exchange-Ticker Pair
Example: ITS:SOGN
Client portfolio ID
Example: D00013
Exchange code
Example: ITS
Average price
Example: 170.21
Number of units
Example: 1
Number of open positions at the moment of opening (start of trading)
Example: 0
Lot size
Example: 10
Short name
Example: Tesla Inc
Aggregated quantity T0 (units)
Example: 0
Aggregated quantity T1 (units)
Example: 10
Aggregated quantity T2 (units)
Example: 10
Aggregated quantity TFuture (units)
Example: 10
Aggregated quantity T0 (lots)
Example: 0
Aggregated quantity T1 (lots)
Example: 1
Aggregated quantity T2 (lots)
Example: 1
Aggregated quantity TFuture (lots)
Example: 1
Aggregated quantity TFuture (lots)
Example: 1
Aggregated quantity at the moment of opening (start of trading) (lots)
Example: 0
Aggregated quantity (lots)
Example: 1
Aggregated quantity at the moment of opening (start of trading) (units)
Example: 0
Daily unrealized profit or loss on open positions in settlement currency. Shows the difference between the position price at the beginning of the current trading session and its current price
Example: 30
Aggregate unrealized profit or loss on open positions in settlement currency. Reflects the difference between the position opening and current prices
Example: 62.5
True for currency balances (money), false for trading instruments
Example: false
True will return the response including data from snapshot, i.e. from history. False will return only new events
Example: false
The unique identifier of the operation. All incoming messages related to this operation will have this guid field value
Example: c328fcf1-e495-408a-a0ed-e20f95d6b813
- Response body
- Schema
{
"data": {
"v": 4900,
"cv": 4962.5,
"sym": "AAPL",
"tic": "ITS:AAPL",
"p": "D00013",
"ex": "ITS",
"pxavg": 196,
"q": 25,
"o": 25,
"lot": 1,
"n": "Apple Inc.",
"q0": 25,
"q1": 25,
"q2": 25,
"qf": 25,
"upd": 30,
"up": 62.5,
"cur": false,
"h": true
},
"guid": "c328fcf1-e495-408a-a0ed-e20f95d6b813"
}
Response body parameters
data
object
Requested data
Position volume in settlement currency, based on the medium lot price (avgPrice|pxavg)
Example: 1702.10
Position volume in settlement currency, based on the current lot price
Example: 1603.20
Security code (ticker)
Example: SOGN
Exchange-Ticker Pair
Example: ITS:SOGN
Client portfolio ID
Example: D00013
Exchange code
Example: ITS
Average price
Example: 170.21
Number of units
Example: 1
Number of open positions at the moment of opening (start of trading)
Example: 0
Lot size
Example: 10
Short name
Example: Tesla Inc
Aggregated quantity T0 (units)
Example: 0
Aggregated quantity T1 (units)
Example: 10
Aggregated quantity T2 (units)
Example: 10
Aggregated quantity TFuture (units)
Example: 10
Daily unrealized profit or loss on open positions in settlement currency. Shows the difference between the position price at the beginning of the current trading session and its current price
Example: 30
Aggregate unrealized profit or loss on open positions in settlement currency. Reflects the difference between the position opening and current prices
Example: 62.5
True for currency balances (money), false for trading instruments
Example: false
True will return the response including data from snapshot, i.e. from history. False will return only new events
Example: false
The unique identifier of the operation. All incoming messages related to this operation will have this guid field value
Example: c328fcf1-e495-408a-a0ed-e20f95d6b813
- Response body
- Schema
{
"data": {
"volume": 4900,
"currentVolume": 4962.5,
"symbol": "AAPL",
"brokerSymbol": "ITS:AAPL",
"portfolio": "D00013",
"exchange": "ITS",
"avgPrice": 196,
"qtyUnits": 25,
"openUnits": 25,
"lotSize": 1,
"shortName": "Apple Inc.",
"qtyT0": 25,
"qtyT1": 25,
"qtyT2": 25,
"qtyTFuture": 25,
"qtyT0Batch": 25,
"qtyT1Batch": 25,
"qtyT2Batch": 25,
"qtyTFutureBatch": 25,
"openQtyBatch": 25,
"dailyUnrealisedPl": 30,
"unrealisedPl": 62.5,
"isCurrency": false,
"existing": true
},
"guid": "c328fcf1-e495-408a-a0ed-e20f95d6b813"
}
Response body parameters
data
object
Requested data
Position volume in settlement currency, based on the medium lot price (avgPrice|pxavg)
Example: 1702.10
Position volume in settlement currency, based on the current lot price
Example: 1603.20
Security code (ticker)
Example: SOGN
Exchange-Ticker Pair
Example: ITS:SOGN
Client portfolio ID
Example: D00013
Exchange code
Example: ITS
Average price
Example: 170.21
Number of units
Example: 1
Number of open positions at the moment of opening (start of trading)
Example: 0
Lot size
Example: 10
Short name
Example: Tesla Inc
Aggregated quantity T0 (units)
Example: 0
Aggregated quantity T1 (units)
Example: 10
Aggregated quantity T2 (units)
Example: 10
Aggregated quantity TFuture (units)
Example: 10
Aggregated quantity T0 (lots)
Example: 0
Aggregated quantity T1 (lots)
Example: 1
Aggregated quantity T2 (lots)
Example: 1
Aggregated quantity TFuture (lots)
Example: 1
Aggregated quantity at the moment of opening (start of trading) (lots)
Example: 0
Daily unrealized profit or loss on open positions in settlement currency. Shows the difference between the position price at the beginning of the current trading session and its current price
Example: 30
Aggregate unrealized profit or loss on open positions in settlement currency. Reflects the difference between the position opening and current prices
Example: 62.5
True for currency balances (money), false for trading instruments
Example: false
True will return the response including data from snapshot, i.e. from history. False will return only new events
Example: false
The unique identifier of the operation. All incoming messages related to this operation will have this guid field value
Example: c328fcf1-e495-408a-a0ed-e20f95d6b813
Successful request processing report
- Body
- Schema
{
"message": "Handled successfully",
"httpCode": 200,
"requestGuid": "c328fcf1-e495-408a-a0ed-e20f95d6b813"
}
Response body parameters
Text description of the returned HTTP code
Example: Handled successfully
HTTP message code
Example: 200
The unique identifier of the operation. All incoming messages related to this operation will have this guid field value
Example: c328fcf1-e495-408a-a0ed-e20f95d6b813
Failed to process request. Access token is invalid, not specified in the message or belongs to other system environment
- Body
- Schema
{
"requestGuid": "c328fcf1-e495-408a-a0ed-e20f95d6b813",
"httpCode": 401,
"message": "Invalid JWT token!"
}
Response body parameters
The unique identifier of the operation. All incoming messages related to this operation will have this guid field value
Example: c328fcf1-e495-408a-a0ed-e20f95d6b813
HTTP message code
Example: 401
Text description of the returned HTTP code
Example: Invalid JWT token!