Portfolio orders (conditional)
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 receive information about all conditional orders related to 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": "StopOrdersGetAndSubscribeV2",
"portfolio": "D39004",
"orderStatuses": [
"filled"
],
"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 subscriptionworking
— Waiting for executionfilled
— Executedcanceled
— Canceledrejected
— Rejectedtrue
— 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
Optional filter by order statuses. Affects only the filtering of primary historical data at subscription. Possible values:
Example: filled
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": {
"id": "8939",
"exchangeOrderId": null,
"symbol": "GAZP",
"brokerSymbol": "MOEX:GAZP",
"portfolio": "D00013",
"exchange": "MOEX",
"type": "stop",
"side": "buy",
"condition": "LessOrEqual",
"status": "working",
"transTime": "2024-01-09T11:32:51.4774506Z",
"updateTime": null,
"endTime": "2060-12-31T23:59:59.0000000Z",
"error": null,
"qtyUnits": 10,
"qtyBatch": 1,
"qty": 1,
"filled": 0,
"filledQtyUnits": 0,
"filledQtyBatch": 0,
"price": 0,
"avg_price": 0,
"stopPrice": 160,
"existing": false,
"timeInForce": "oneday",
"iceberg": null,
"volume": 1600,
"protectingSeconds": 15
},
"guid": "c328fcf1-e495-408a-a0ed-e20f95d6b813"
}
Response body parameters
MOEX
— Moscow ExchangeSPBX
— SPB Exchangestop
— Stop orderstoplimit
— Stop limit orderbuy
sell
More
— Current price is higher that trigger priceLess
— Current price is lower than trigger priceMoreOrEqual
— Current price is higher or equal to the trigger priceLessOrEqual
— Current price is lower or equal to the trigger priceworking
— Waiting for executionfilled
— Executedcanceled
— Canceledrejected
— RejectedOneDay
— Fulfill the order or keep it active till the end of the trading dayImmediateOrCancel
— Partially fulfill the order and cancel the unfulfilled balanceFillOrKill
— Fulfill completely or cancel the entire orderGoodTillCancelled
— Fulfill the order or keep it until cancelation
data
object
Requested data
Unique conditional order ID
Example: 8939
Unique exchange order ID
Example: 425242362
Security code (ticker)
Example: SBER
Exchange-Ticker Pair
Example: MOEX:ALRS-3.24
Client portfolio ID
Example: D39004
Exchange code:
Example: MOEX
Order type:
Example: stop
Transaction side:
Example: sell
Triggering condition for stop and stop limit orders:
Example: LessOrEqual
Order status:
Example: working
Date and time of order transaction (UTC)
Example: 2024-01-08T15:57:12.2911671Z
Date and time of order update (UTC)
Example: 2024-01-08T15:57:12.2911671Z
Date and time of closing order (UTC)
Example: 2024-12-27T23:59:59.9990000Z
Reason of the stop order cancel
Example: Price is not a multiple of the minimum price step
Number of units
Example: 1
Number of lots
Example: 1
Number of lots
Example: 1
Number of units filled
Example: 0
Number of units filled
Example: 0
Number of lots filled
Example: 0
Price
Example: 271.57
Average price
Example: 0
Trigger price
Example: 160
True
will return the response including data from snapshot, i.e. from history. False
will return only new events
Example: false
Order validity type:
Example: OneDay
iceberg
object
Special fields for transactions with hidden part
The visible constant part of the iceberg order in lots set out at the order creation
Example: 100
The deviation amplitude (% of icebergFixed) of the random increment to the visible part of the iceberg order set out at the order creation. Derivatives only
Example: 2
Number of visible units
Example: 0
Number of visible lots
Example: 0
Number of filled visible units
Example: 0
Number of filled visible lots
Example: 0
Volume. Null
for market orders
Example: 6400.00000
Protective time. Continuous period of time in seconds, during which the market price of the instrument must satisfy the price and triggering condition specified in the order (triggerPrice
and condition
). It is intended to protect conditional orders from triggering on short-term price fluctuations.
Example: 15
15
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": {
"id": "8939",
"eid": null,
"sym": "GAZP",
"tic": "MOEX:GAZP",
"p": "D00013",
"ex": "MOEX",
"t": "stop",
"s": "buy",
"cnd": "lessorequal",
"st": "working",
"tt": "2024-01-09T11:32:51.4774506Z",
"ut": null,
"et": "2060-12-31T23:59:59.0000000Z",
"err": null,
"q": 10,
"qb": 1,
"fq": 0,
"fqb": 0,
"px": 0,
"pxavg": 0,
"pxs": 160,
"h": true,
"tf": "oneday",
"i": null,
"v": 1600,
"psec": 15
},
"guid": "c328fcf1-e495-408a-a0ed-e20f95d6b813"
}
Response body parameters
MOEX
— Moscow ExchangeSPBX
— SPB Exchangestop
— Stop orderstoplimit
— Stop limit orderbuy
sell
More
— Current price is higher that trigger priceLess
— Current price is lower than trigger priceMoreOrEqual
— Current price is higher or equal to the trigger priceLessOrEqual
— Current price is lower or equal to the trigger priceworking
— Waiting for executionfilled
— Executedcanceled
— Canceledrejected
— RejectedOneDay
— Fulfill the order or keep it active till the end of the trading dayImmediateOrCancel
— Partially fulfill the order and cancel the unfulfilled balanceFillOrKill
— Fulfill completely or cancel the entire orderGoodTillCancelled
— Fulfill the order or keep it until cancelation
data
object
Requested data
Unique conditional order ID
Example: 8939
Unique exchange order ID
Example: 425242362
Security code (ticker)
Example: SBER
Exchange-Ticker Pair
Example: MOEX:ALRS-3.24
Client portfolio ID
Example: D39004
Exchange code:
Example: MOEX
Order type:
Example: stop
Transaction side:
Example: sell
Triggering condition for stop and stop limit orders:
Example: LessOrEqual
Order status:
Example: working
Date and time of order transaction (UTC)
Example: 2024-01-08T15:57:12.2911671Z
Date and time of order update (UTC)
Example: 2024-01-08T15:57:12.2911671Z
Date and time of closing order (UTC)
Example: 2024-12-27T23:59:59.9990000Z
Reason of the stop order cancel
Example: Price is not a multiple of the minimum price step
Number of units
Example: 1
Number of lots
Example: 1
Number of units filled
Example: 0
Number of lots filled
Example: 0
Price
Example: 271.57
Average price
Example: 0
Trigger price
Example: 160
True
will return the response including data from snapshot, i.e. from history. False
will return only new events
Example: false
Order validity type:
Example: OneDay
i
object
Special fields for transactions with hidden part
The visible constant part of the iceberg order in lots set out at the order creation
Example: 100
The deviation amplitude (% of icebergFixed) of the random increment to the visible part of the iceberg order set out at the order creation. Derivatives only
Example: 2
Number of visible units
Example: 0
Number of visible lots
Example: 0
Number of filled visible units
Example: 0
Number of filled visible lots
Example: 0
Volume. Null
for market orders
Example: 6400.00000
Protective time. Continuous period of time in seconds, during which the market price of the instrument must satisfy the price and triggering condition specified in the order (triggerPrice
and condition
). It is intended to protect conditional orders from triggering on short-term price fluctuations.
Example: 15
15
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": {
"id": "8939",
"exchangeOrderId": null,
"symbol": "GAZP",
"brokerSymbol": "MOEX:GAZP",
"portfolio": "D00013",
"exchange": "MOEX",
"type": "stop",
"side": "buy",
"condition": "lessorequal",
"status": "working",
"transTime": "2024-01-09T11:32:51.4774506Z",
"updateTime": null,
"endTime": "2060-12-31T23:59:59.0000000Z",
"error": null,
"qtyUnits": 10,
"qtyBatch": 1,
"filledQtyUnits": 0,
"filledQtyBatch": 0,
"price": 0,
"avgPrice": 0,
"stopPrice": 160,
"existing": true,
"timeInForce": "oneday",
"iceberg": null,
"volume": 1600,
"protectingSeconds": 15
},
"guid": "c328fcf1-e495-408a-a0ed-e20f95d6b813"
}
Response body parameters
MOEX
— Moscow ExchangeSPBX
— SPB Exchangestop
— Stop orderstoplimit
— Stop limit orderbuy
sell
More
— Current price is higher that trigger priceLess
— Current price is lower than trigger priceMoreOrEqual
— Current price is higher or equal to the trigger priceLessOrEqual
— Current price is lower or equal to the trigger priceworking
— Waiting for executionfilled
— Executedcanceled
— Canceledrejected
— RejectedOneDay
— Fulfill the order or keep it active till the end of the trading dayImmediateOrCancel
— Partially fulfill the order and cancel the unfulfilled balanceFillOrKill
— Fulfill completely or cancel the entire orderGoodTillCancelled
— Fulfill the order or keep it until cancelation
data
object
Requested data
Unique conditional order ID
Example: 8939
Unique exchange order ID
Example: 425242362
Security code (ticker)
Example: SBER
Exchange-Ticker Pair
Example: MOEX:ALRS-3.24
Client portfolio ID
Example: D39004
Exchange code:
Example: MOEX
Order type:
Example: stop
Transaction side:
Example: sell
Triggering condition for stop and stop limit orders:
Example: LessOrEqual
Order status:
Example: working
Date and time of order transaction (UTC)
Example: 2024-01-08T15:57:12.2911671Z
Date and time of order update (UTC)
Example: 2024-01-08T15:57:12.2911671Z
Date and time of closing order (UTC)
Example: 2024-12-27T23:59:59.9990000Z
Reason of the stop order cancel
Example: Price is not a multiple of the minimum price step
Number of units
Example: 1
Number of lots
Example: 1
Number of units filled
Example: 0
Number of lots filled
Example: 0
Price
Example: 271.57
Average price
Example: 0
Trigger price
Example: 160
True
will return the response including data from snapshot, i.e. from history. False
will return only new events
Example: false
Order validity type:
Example: OneDay
iceberg
object
Special fields for transactions with hidden part
The visible constant part of the iceberg order in lots set out at the order creation
Example: 100
The deviation amplitude (% of icebergFixed) of the random increment to the visible part of the iceberg order set out at the order creation. Derivatives only
Example: 2
Number of visible units
Example: 0
Number of visible lots
Example: 0
Number of filled visible units
Example: 0
Number of filled visible lots
Example: 0
Volume. Null
for market orders
Example: 6400.00000
Protective time. Continuous period of time in seconds, during which the market price of the instrument must satisfy the price and triggering condition specified in the order (triggerPrice
and condition
). It is intended to protect conditional orders from triggering on short-term price fluctuations.
Example: 15
15
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!