Skip to main content

Portfolio positions

Private resource

The request cannot be executed anonymously. The required token parameter must contain an up-to-date Access Token.

HTTP API

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.

{
"opcode": "PositionsGetAndSubscribeV2",
"portfolio": "D39004",
"skipHistory": false,
"exchange": "MOEX",
"instrumentGroup": "TQBR",
"format": "Simple",
"guid": "c328fcf1-e495-408a-a0ed-e20f95d6b813",
"token": "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 200 code message in response, confirming that the subscription has been created, after which it will begin transmitting 100 code 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.

Messages from the channel containing the requested information

{
"data": {
"volume": 1702.10,
"currentVolume": 1603.20,
"symbol": "GAZP",
"brokerSymbol": "MOEX:GAZP",
"portfolio": "D00013",
"exchange": "MOEX",
"avgPrice": 170.21,
"qtyUnits": 10,
"openUnits": 0,
"lotSize": 10,
"shortName": "Gazprom jsc",
"qtyT0": 0,
"qtyT1": 10,
"qtyT2": 10,
"qtyTFuture": 10,
"qtyT0Batch": 0,
"qtyT1Batch": 1,
"qtyT2Batch": 1,
"qtyTFutureBatch": 1,
"qtyBatch": 1,
"openQtyBatch": 0,
"qty": 1,
"open": 0,
"dailyUnrealisedPl": 11.80,
"unrealisedPl": -98.90,
"isCurrency": false,
"existing": false
},
"guid": "c328fcf1-e495-408a-a0ed-e20f95d6b813"
}