The MARK_PRICE WebSocket channel sends the mark price of futures instruments every 5 seconds, as MARK_PRICE_UPDATE messages.Only futures instrument codes (e.g. BTC_USD_P) have a mark price. A spot instrument code is rejected.
Subscribe#
instrument_codes is optional on this channel. Leave it out to receive the mark price of every futures instrument:{
"type": "SUBSCRIBE",
"channels": [
{
"name": "MARK_PRICE"
}
]
}
Or list the instruments you want:{
"type": "SUBSCRIBE",
"channels": [
{
"name": "MARK_PRICE",
"instrument_codes": [
"BTC_USD_P",
"ETH_USD_P"
]
}
]
}
Subscription Confirmation#
instrument_codes is present only when you listed them.{
"type": "SUBSCRIPTIONS",
"channels": [
{
"name": "MARK_PRICE",
"instrument_codes": [
"BTC_USD_P",
"ETH_USD_P"
]
}
],
"time": 1762700000299000000
}
The current mark prices are sent straight after the confirmation. From then on, one message per instrument is sent every 5 seconds, on the clock (:00, :05, :10, …).Changing the instruments#
A connection has one MARK_PRICE selection: every instrument, or a list. A new SUBSCRIBE replaces it, so you never receive a mark twice. UPDATE_SUBSCRIPTION does the same and answers with SUBSCRIPTION_UPDATED:{
"type": "UPDATE_SUBSCRIPTION",
"channels": [
{
"name": "MARK_PRICE",
"instrument_codes": [
"SOL_USD_P"
]
}
]
}
{
"type": "SUBSCRIPTION_UPDATED",
"channel_name": "MARK_PRICE"
}
A request that is rejected leaves the previous selection in place.Errors#
{
"channel_name": "MARK_PRICE",
"error": "INVALID_INSTRUMENT_CODES",
"invalid_instruments": [
"BTC_USDT"
]
}
error | Meaning |
|---|
INVALID_INSTRUMENT_CODES_LIST | instrument_codes was sent as an empty list. Leave the field out to receive every instrument. |
INVALID_INSTRUMENT_CODES | One or more instrument codes are unknown, or are spot instruments. They are listed in invalid_instruments. |