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",
"portfolio": "D39004",
"skipHistory": false,
"exchange": "MOEX",
"instrumentGroup": "TQBR",
"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 risksSpectraRisksGetAndSubscribe
— Subscription to information on derivatives market risks (FORTS)TradesGetAndSubscribeV2
— 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 dataMOEX
— Moscow ExchangeSPBX
— SPB Exchange- List of Moscow Exchange codes is available in table
- SPB Exchange securities always have
SPBX
code Simple
is the original data format. Supports legacy (deprecated) parameters to ensure backward compatibilitySlim
is the lightweight data format for fast messaging. Does not support legacy (deprecated) parametersHeavy
is the complete data format, evolving and augmented with new fields. Does not support legacy (deprecated) parameters
Operation code:
Client portfolio ID
Example: D39004
Flag for filtering out historical data:
Example: false
Exchange code:
Example: MOEX
Trading mode code (Board):
Example: TQBR
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
200
code message in response, confirming that the subscription has been created, after which it will begin transmitting100
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.
- 100
- 200
- 401
Messages from the channel containing the requested information
- Simple
- Slim
- Heavy
- Response body
- Schema
{
"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"
}
Response body parameters
MOEX
— Moscow ExchangeSPBX
— SPB Exchange
data
object
Requested data
Volume calculated at average price
Example: 1702.10
Volume calculated at current price
Example: 1603.20
Security code (ticker)
Example: SBER
Exchange-Ticker Pair
Example: MOEX:ALRS-3.24
Client portfolio ID
Example: D39004
Exchange code:
Example: MOEX
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: Gazprom jsc
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
Total day profit or total loss in percent
Example: 11.80
Total day profit or total loss in settlement currency
Example: -98.90
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": 1702.10,
"cv": 1602.50,
"sym": "GAZP",
"tic": "MOEX:GAZP",
"p": "D00013",
"ex": "MOEX",
"pxavg": 170.21,
"q": 10,
"o": 0,
"lot": 10,
"n": "Gazprom jsc",
"q0": 0,
"q1": 10,
"q2": 10,
"qf": 10,
"upd": 10.60,
"up": -100.10,
"cur": false,
"h": false
},
"guid": "c328fcf1-e495-408a-a0ed-e20f95d6b813"
}
Response body parameters
MOEX
— Moscow ExchangeSPBX
— SPB Exchange
data
object
Requested data
Volume calculated at average price
Example: 1702.10
Volume calculated at current price
Example: 1603.20
Security code (ticker)
Example: SBER
Exchange-Ticker Pair
Example: MOEX:ALRS-3.24
Client portfolio ID
Example: D39004
Exchange code:
Example: MOEX
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: Gazprom jsc
Aggregated quantity T0 (units)
Example: 0
Aggregated quantity T1 (units)
Example: 10
Aggregated quantity T2 (units)
Example: 10
Aggregated quantity TFuture (units)
Example: 10
Total day profit or total loss in percent
Example: 11.80
Total day profit or total loss in settlement currency
Example: -98.90
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": 1702.10,
"currentVolume": 1602.30,
"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,
"openQtyBatch": 0,
"dailyUnrealisedPl": 10.90,
"unrealisedPl": -99.80,
"isCurrency": false,
"existing": false
},
"guid": "c328fcf1-e495-408a-a0ed-e20f95d6b813"
}
Response body parameters
MOEX
— Moscow ExchangeSPBX
— SPB Exchange
data
object
Requested data
Volume calculated at average price
Example: 1702.10
Volume calculated at current price
Example: 1603.20
Security code (ticker)
Example: SBER
Exchange-Ticker Pair
Example: MOEX:ALRS-3.24
Client portfolio ID
Example: D39004
Exchange code:
Example: MOEX
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: Gazprom jsc
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
Total day profit or total loss in percent
Example: 11.80
Total day profit or total loss in settlement currency
Example: -98.90
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!