{"asyncapi":"3.0.0","info":{"title":"One Trading WebSocket API","version":"1.0.0","description":"Real-time market data, account events and order entry over a single WebSocket connection.\n\n## Connection\n\nConnect to `wss://streams.fast.onetrading.com`. All channels share this connection, and each pushed message carries a `channel_name` identifying its channel. The server sends a `HEARTBEAT` every 10 seconds from the moment you connect. It expects no reply, but the connection has an idle timeout of 300 seconds: sending a native WebSocket ping each time a heartbeat arrives keeps well inside it, and if no pong comes back, reconnect.\n\n## Authentication\n\nPrivate channels (`TRADING`, `ACCOUNT`) require authentication before subscription. Send an `AUTHENTICATE` message with an API token generated in the One Trading UI; the token must have the `Trade` permission. A valid token authorises all private channels for the rest of the connection. The token is sent in the message body, not in an HTTP header. If the token is rejected, the server answers with an error and closes the connection with close code `3000`.\n\n## Subscribing\n\nSend `SUBSCRIBE` naming **one** channel per message. `ORDER_BOOK`, `PRICE_TICKS` and `BOOK_TICKER` require an `instrument_codes` list; for `MARK_PRICE` it is optional. The server confirms with `SUBSCRIPTIONS`. After subscribing to `TRADING` you can also send order requests on the same socket.\n\nA further `SUBSCRIBE` to a channel you already have adds its instruments to the ones you receive; it never removes any. `MARK_PRICE` is the exception: a new `SUBSCRIBE` replaces its selection. To stop receiving a channel, send `UNSUBSCRIBE`, which drops all of that channel's instruments.\n\n## Rate limits\n\nOrder requests (`CREATE_ORDER`, `MOVE_ORDER`, `CANCEL_ORDER` and `CANCEL_ALL_ORDERS`) share one token bucket per account. It holds 600 requests a minute for retail accounts, 2,000 for institutional accounts and 15,360 for market makers, and refills continuously at that rate, so you can send a burst of up to the full minute's allowance. A request over the limit is not sent to the exchange: it is answered with `RATE_LIMITED`.\n\n## Errors and disconnection\n\n- A message that is not valid JSON is answered with `{\"error\": \"INVALID_MESSAGE_FORMAT\"}`, and the server closes the connection with close code `4000`.\n- A message with an unknown `type` is ignored: no reply is sent.\n- A client that does not read messages as fast as they are sent is disconnected with close code `1006`.\n- Nothing is replayed after a reconnect. On a new connection, authenticate and subscribe again, and use the REST API to read any state you may have missed.\n\n## Conventions\n\n- **Timestamps:** market data channels, `TRADING` and connection messages use integer nanoseconds since the Unix epoch (`time`). These exceed JavaScript's safe integer range, so parse them with a 64-bit-safe JSON parser. A `time` that the WebSocket server stamps itself, such as on `SUBSCRIPTIONS` and `HEARTBEAT`, is in nanoseconds but may be up to 1 second out, so do not use it to order messages. The `ACCOUNT` channel uses ISO 8601 strings (`time`, `event_timestamp`).\n- **Decimals:** prices and amounts are decimal strings. The exception is `ACCOUNT`, where TP/SL levels are numbers.","tags":[{"name":"connection","description":"Authentication, subscribing and unsubscribing, heartbeats and errors.","x-displayName":"Connection"},{"name":"order-book","description":"Order book snapshot and incremental updates.","x-displayName":"Order book"},{"name":"price-ticks","description":"One tick per executed trade.","x-displayName":"Price ticks"},{"name":"book-ticker","description":"Best bid and ask for the instruments you subscribe to.","x-displayName":"Book ticker"},{"name":"mark-price","description":"Futures mark prices every 5 seconds.","x-displayName":"Mark price"},{"name":"trading","description":"Private: order entry and your order, margin and balance events.","x-displayName":"Trading"},{"name":"account","description":"Private: take profit / stop loss events for your main account and subaccounts.","x-displayName":"Account"}]},"defaultContentType":"application/json","servers":{"production":{"host":"streams.fast.onetrading.com","protocol":"wss","title":"Production","description":"One Trading production WebSocket endpoint."}},"channels":{"connection":{"address":"/","title":"Connection","description":"Connection-level messages on the shared socket: authentication, generic subscribe and unsubscribe, heartbeats and errors.","messages":{"authenticate":{"$ref":"#/components/messages/authenticate"},"authenticated":{"$ref":"#/components/messages/authenticated"},"authenticationFailed":{"$ref":"#/components/messages/authenticationFailed"},"subscribe":{"$ref":"#/components/messages/subscribe"},"subscriptions":{"$ref":"#/components/messages/subscriptions"},"subscriptionError":{"$ref":"#/components/messages/subscriptionError"},"unsubscribe":{"$ref":"#/components/messages/unsubscribe"},"unsubscribed":{"$ref":"#/components/messages/unsubscribed"},"unsubscribeError":{"$ref":"#/components/messages/unsubscribeError"},"heartbeat":{"$ref":"#/components/messages/heartbeat"}}},"orderBook":{"address":"/","title":"ORDER_BOOK","description":"Real-time order book data for the subscribed markets: an initial snapshot giving a complete view of active bids and asks, then incremental updates as changes occur, such as new orders, modifications, or cancellations. The snapshot is always the first order book message you receive for an instrument, and `unum_bids` and `unum_asks` let you check that no update has been missed.","messages":{"subscribeOrderBook":{"$ref":"#/components/messages/subscribeOrderBook"},"orderBookSubscribed":{"$ref":"#/components/messages/orderBookSubscribed"},"subscriptionError":{"$ref":"#/components/messages/subscriptionError"},"orderBookSnapshot":{"$ref":"#/components/messages/orderBookSnapshot"},"orderBookUpdate":{"$ref":"#/components/messages/orderBookUpdate"}}},"priceTicks":{"address":"/","title":"PRICE_TICKS","description":"Real-time price updates for the subscribed markets. Each tick represents a single trade execution, including price, quantity and nanosecond timestamp. For each instrument code, a `PRICE_TICK_HISTORY` holding up to the latest `80` price ticks is sent first.","messages":{"subscribePriceTicks":{"$ref":"#/components/messages/subscribePriceTicks"},"priceTicksSubscribed":{"$ref":"#/components/messages/priceTicksSubscribed"},"subscriptionError":{"$ref":"#/components/messages/subscriptionError"},"priceTickHistory":{"$ref":"#/components/messages/priceTickHistory"},"priceTick":{"$ref":"#/components/messages/priceTick"}}},"bookTicker":{"address":"/","title":"BOOK_TICKER","description":"Real-time best bid and ask prices, with their quantities, for the instruments you subscribe to. A lightweight alternative to ORDER_BOOK for strategies that rely on top-of-book information. A `BOOK_TICKER_SNAPSHOT` with the current top of the book is sent for each instrument when you subscribe.","messages":{"subscribeBookTicker":{"$ref":"#/components/messages/subscribeBookTicker"},"bookTickerSubscribed":{"$ref":"#/components/messages/bookTickerSubscribed"},"subscriptionError":{"$ref":"#/components/messages/subscriptionError"},"bookTickerSnapshot":{"$ref":"#/components/messages/bookTickerSnapshot"},"bookTick":{"$ref":"#/components/messages/bookTick"}}},"markPrice":{"address":"/","title":"MARK_PRICE","description":"The mark price of futures instruments, every 5 seconds. Only futures instrument codes (e.g. `BTC_USD_P`) have a mark price; a spot instrument code is rejected.","messages":{"subscribeMarkPrice":{"$ref":"#/components/messages/subscribeMarkPrice"},"markPriceSubscribed":{"$ref":"#/components/messages/markPriceSubscribed"},"updateMarkPriceSubscription":{"$ref":"#/components/messages/updateMarkPriceSubscription"},"markPriceSubscriptionUpdated":{"$ref":"#/components/messages/markPriceSubscriptionUpdated"},"markPriceError":{"$ref":"#/components/messages/markPriceError"},"subscriptionError":{"$ref":"#/components/messages/subscriptionError"},"markPriceUpdate":{"$ref":"#/components/messages/markPriceUpdate"}}},"trading":{"address":"/","title":"TRADING","description":"Private. Create, move and cancel orders, and receive a feed of order updates based on the trading activity in your account. You must be authenticated (token with the `Trade` permission) and subscribed to this channel to send trading messages. Order requests share one rate limit per account (see Rate limits).","messages":{"subscribeTrading":{"$ref":"#/components/messages/subscribeTrading"},"tradingSubscribed":{"$ref":"#/components/messages/tradingSubscribed"},"subscriptionError":{"$ref":"#/components/messages/subscriptionError"},"createOrder":{"$ref":"#/components/messages/createOrder"},"moveOrder":{"$ref":"#/components/messages/moveOrder"},"cancelOrderByClientId":{"$ref":"#/components/messages/cancelOrderByClientId"},"cancelOrderByOrderId":{"$ref":"#/components/messages/cancelOrderByOrderId"},"cancelAllOrders":{"$ref":"#/components/messages/cancelAllOrders"},"orderError":{"$ref":"#/components/messages/orderError"},"orderNotFound":{"$ref":"#/components/messages/orderNotFound"},"noOrdersToCancel":{"$ref":"#/components/messages/noOrdersToCancel"},"cancellationsBooked":{"$ref":"#/components/messages/cancellationsBooked"},"orderBookedSpot":{"$ref":"#/components/messages/orderBookedSpot"},"orderBookedFutures":{"$ref":"#/components/messages/orderBookedFutures"},"orderRejectedSpot":{"$ref":"#/components/messages/orderRejectedSpot"},"orderRejectedFutures":{"$ref":"#/components/messages/orderRejectedFutures"},"orderClosedSpot":{"$ref":"#/components/messages/orderClosedSpot"},"orderClosedFutures":{"$ref":"#/components/messages/orderClosedFutures"},"tradeExecutedSpot":{"$ref":"#/components/messages/tradeExecutedSpot"},"tradeExecutedFutures":{"$ref":"#/components/messages/tradeExecutedFutures"},"orderFullyFilledSpot":{"$ref":"#/components/messages/orderFullyFilledSpot"},"orderFullyFilledFutures":{"$ref":"#/components/messages/orderFullyFilledFutures"},"orderMoved":{"$ref":"#/components/messages/orderMoved"},"marginUpdate":{"$ref":"#/components/messages/marginUpdate"},"settlement":{"$ref":"#/components/messages/settlement"},"fundingPayment":{"$ref":"#/components/messages/fundingPayment"},"balanceAdjustment":{"$ref":"#/components/messages/balanceAdjustment"}}},"account":{"address":"/","title":"ACCOUNT","description":"Private. Events about your account, such as changes of state of your take profit / stop loss orders (TP/SLs). One subscription covers your main account and every subaccount; each message carries the `account_id` it belongs to. The channel sends no snapshot, and messages are not replayed after a reconnect: use Get Exotic Orders (TP/SL) on the REST API to read the current state.","messages":{"subscribeAccount":{"$ref":"#/components/messages/subscribeAccount"},"accountSubscribed":{"$ref":"#/components/messages/accountSubscribed"},"subscriptionError":{"$ref":"#/components/messages/subscriptionError"},"exoticOrderRegistered":{"$ref":"#/components/messages/exoticOrderRegistered"},"exoticOrderUpdated":{"$ref":"#/components/messages/exoticOrderUpdated"},"exoticOrderActivated":{"$ref":"#/components/messages/exoticOrderActivated"},"exoticOrderTriggered":{"$ref":"#/components/messages/exoticOrderTriggered"},"exoticOrderExecuted":{"$ref":"#/components/messages/exoticOrderExecuted"},"exoticOrderCancelled":{"$ref":"#/components/messages/exoticOrderCancelled"}}}},"operations":{"authenticate":{"action":"receive","channel":{"$ref":"#/channels/connection"},"title":"Authenticate","summary":"Authenticate the connection with an API token.","description":"All private channels (`TRADING`, `ACCOUNT`) require authentication before subscription. Send `AUTHENTICATE` with your API token; if it is valid, it authorises subscriptions and requests for all private channels on this connection. Generate a token in the One Trading UI, with the `Trade` permission. If the token is rejected, the server sends `AUTH_ERROR` or `ACCOUNT_RESTRICTED` and then closes the connection with close code `3000`.","tags":[{"name":"connection"}],"messages":[{"$ref":"#/channels/connection/messages/authenticate"}],"reply":{"channel":{"$ref":"#/channels/connection"},"messages":[{"$ref":"#/channels/connection/messages/authenticated"},{"$ref":"#/channels/connection/messages/authenticationFailed"}]}},"subscribe":{"action":"receive","channel":{"$ref":"#/channels/connection"},"title":"Subscribe","summary":"Subscribe to a channel.","description":"Before you can receive or send messages on a channel, you must subscribe to it. Only **one** channel can be named per `SUBSCRIBE` message. Each channel section documents its exact subscribe message and confirmation.\n\nSubscribing is additive: a further `SUBSCRIBE` to a channel you already have adds its instruments to the ones you receive, and never removes any. `MARK_PRICE` is the exception, where a new `SUBSCRIBE` replaces the selection. To drop instruments, `UNSUBSCRIBE` from the channel and subscribe again.","tags":[{"name":"connection"}],"messages":[{"$ref":"#/channels/connection/messages/subscribe"}],"reply":{"channel":{"$ref":"#/channels/connection"},"messages":[{"$ref":"#/channels/connection/messages/subscriptions"},{"$ref":"#/channels/connection/messages/subscriptionError"}]}},"unsubscribe":{"action":"receive","channel":{"$ref":"#/channels/connection"},"title":"Unsubscribe","summary":"Unsubscribe from one or more channels.","description":"Send `UNSUBSCRIBE` with the names of the channels to leave. Unlike `SUBSCRIBE`, one message can name several channels. Unsubscribing from a market data channel drops all of its instruments. The server answers with one `UNSUBSCRIBED` per channel, or an `UNSUBSCRIBE_ERROR` for a channel it cannot unsubscribe, such as an unknown name.","tags":[{"name":"connection"}],"messages":[{"$ref":"#/channels/connection/messages/unsubscribe"}],"reply":{"channel":{"$ref":"#/channels/connection"},"messages":[{"$ref":"#/channels/connection/messages/unsubscribed"},{"$ref":"#/channels/connection/messages/unsubscribeError"}]}},"heartbeat":{"action":"send","channel":{"$ref":"#/channels/connection"},"title":"Heartbeat","summary":"Heartbeat from the server every 10 seconds.","description":"The server sends a `HEARTBEAT` every 10 seconds to every connection, from the moment it opens and whether or not it has subscribed to anything. It expects no reply: there is no application-level pong. The connection has an idle timeout of 300 seconds, though, so a recommended strategy is to send a native WebSocket ping each time a heartbeat arrives. If no pong comes back, close the socket and reconnect.","tags":[{"name":"connection"}],"messages":[{"$ref":"#/channels/connection/messages/heartbeat"}]},"subscribeOrderBook":{"action":"receive","channel":{"$ref":"#/channels/orderBook"},"title":"Subscribe to ORDER_BOOK","summary":"Subscribe to the ORDER_BOOK channel.","description":"Send a `SUBSCRIBE` message naming `ORDER_BOOK`. The server answers with a `SUBSCRIPTIONS` confirmation, or an error. Pass the markets you want in `instrument_codes`, which is required. A further `SUBSCRIBE` adds instruments to the ones you already receive, and sends a fresh snapshot for each instrument it names.","tags":[{"name":"order-book"}],"messages":[{"$ref":"#/channels/orderBook/messages/subscribeOrderBook"}],"reply":{"channel":{"$ref":"#/channels/orderBook"},"messages":[{"$ref":"#/channels/orderBook/messages/orderBookSubscribed"},{"$ref":"#/channels/orderBook/messages/subscriptionError"}]}},"orderBookUpdates":{"action":"send","channel":{"$ref":"#/channels/orderBook"},"title":"Order book updates","summary":"Snapshot, then incremental order book changes.","description":"After subscribing, you receive an `ORDER_BOOK_SNAPSHOT` per instrument, then `ORDER_BOOK_UPDATE` messages as the book changes. You only receive updates for the `instrument_codes` you specified.\n\n**The snapshot comes first.** The server holds back updates for an instrument until its snapshot has been sent, then sends the held updates in order, leaving out any the snapshot already includes. (If no snapshot is available for an instrument, its updates are sent without one.)\n\n**Sequencing.** Every snapshot and update carries `unum_bids` and `unum_asks`. Each update advances both by exactly 1. Keep the values from the last message you applied, and apply an update only when its `unum_bids` and `unum_asks` are each 1 more than those. If an update skips ahead, you have missed one: discard your copy of the book and send `SUBSCRIBE` for that instrument again, which sends a fresh snapshot.","tags":[{"name":"order-book"}],"messages":[{"$ref":"#/channels/orderBook/messages/orderBookSnapshot"},{"$ref":"#/channels/orderBook/messages/orderBookUpdate"}]},"subscribePriceTicks":{"action":"receive","channel":{"$ref":"#/channels/priceTicks"},"title":"Subscribe to PRICE_TICKS","summary":"Subscribe to the PRICE_TICKS channel.","description":"Send a `SUBSCRIBE` message naming `PRICE_TICKS`. The server answers with a `SUBSCRIPTIONS` confirmation, or an error. Pass the markets you want in `instrument_codes`, which is required. A further `SUBSCRIBE` adds instruments to the ones you already receive.","tags":[{"name":"price-ticks"}],"messages":[{"$ref":"#/channels/priceTicks/messages/subscribePriceTicks"}],"reply":{"channel":{"$ref":"#/channels/priceTicks"},"messages":[{"$ref":"#/channels/priceTicks/messages/priceTicksSubscribed"},{"$ref":"#/channels/priceTicks/messages/subscriptionError"}]}},"priceTicks":{"action":"send","channel":{"$ref":"#/channels/priceTicks"},"title":"Price ticks","summary":"Recent history, then one tick per executed trade.","description":"After subscribing, you receive a `PRICE_TICK_HISTORY` per instrument holding up to the 80 most recent ticks, oldest first. Then, when a trade is executed, a `PRICE_TICK` is emitted. You only receive ticks for the `instrument_codes` you specified.","tags":[{"name":"price-ticks"}],"messages":[{"$ref":"#/channels/priceTicks/messages/priceTickHistory"},{"$ref":"#/channels/priceTicks/messages/priceTick"}]},"subscribeBookTicker":{"action":"receive","channel":{"$ref":"#/channels/bookTicker"},"title":"Subscribe to BOOK_TICKER","summary":"Subscribe to the BOOK_TICKER channel.","description":"Send a `SUBSCRIBE` message naming `BOOK_TICKER`. The server answers with a `SUBSCRIPTIONS` confirmation, or an error. Pass the markets you want in `instrument_codes`, which is required; a missing or empty list is rejected with `INVALID_INSTRUMENT_CODES_LIST`. A further `SUBSCRIBE` adds instruments to the ones you already receive.","tags":[{"name":"book-ticker"}],"messages":[{"$ref":"#/channels/bookTicker/messages/subscribeBookTicker"}],"reply":{"channel":{"$ref":"#/channels/bookTicker"},"messages":[{"$ref":"#/channels/bookTicker/messages/bookTickerSubscribed"},{"$ref":"#/channels/bookTicker/messages/subscriptionError"}]}},"bookTickerUpdates":{"action":"send","channel":{"$ref":"#/channels/bookTicker"},"title":"Book ticker updates","summary":"Current top of the book, then best bid and ask updates.","description":"After subscribing, you receive a `BOOK_TICKER_SNAPSHOT` per instrument with the current top of the book, then a `BOOK_TICK` as it changes. Both carry the best bid and ask prices and their amounts for one instrument, in the same `data` shape. You only receive updates for the `instrument_codes` you specified.","tags":[{"name":"book-ticker"}],"messages":[{"$ref":"#/channels/bookTicker/messages/bookTickerSnapshot"},{"$ref":"#/channels/bookTicker/messages/bookTick"}]},"subscribeMarkPrice":{"action":"receive","channel":{"$ref":"#/channels/markPrice"},"title":"Subscribe to MARK_PRICE","summary":"Subscribe to the MARK_PRICE channel.","description":"Send a `SUBSCRIBE` message naming `MARK_PRICE`. The server answers with a `SUBSCRIPTIONS` confirmation, or an error. `instrument_codes` is optional: leave it out to receive every futures instrument. A new `SUBSCRIBE` replaces the previous selection. The current mark prices are sent straight after the confirmation.","tags":[{"name":"mark-price"}],"messages":[{"$ref":"#/channels/markPrice/messages/subscribeMarkPrice"}],"reply":{"channel":{"$ref":"#/channels/markPrice"},"messages":[{"$ref":"#/channels/markPrice/messages/markPriceSubscribed"},{"$ref":"#/channels/markPrice/messages/subscriptionError"},{"$ref":"#/channels/markPrice/messages/markPriceError"}]}},"updateMarkPriceSubscription":{"action":"receive","channel":{"$ref":"#/channels/markPrice"},"title":"Update mark price subscription","summary":"Replace the MARK_PRICE instrument selection.","description":"A connection has one `MARK_PRICE` selection. `UPDATE_SUBSCRIPTION` replaces it, like a new `SUBSCRIBE`, and answers with `SUBSCRIPTION_UPDATED`. A request that is rejected leaves the previous selection in place.","tags":[{"name":"mark-price"}],"messages":[{"$ref":"#/channels/markPrice/messages/updateMarkPriceSubscription"}],"reply":{"channel":{"$ref":"#/channels/markPrice"},"messages":[{"$ref":"#/channels/markPrice/messages/markPriceSubscriptionUpdated"},{"$ref":"#/channels/markPrice/messages/markPriceError"}]}},"markPriceUpdates":{"action":"send","channel":{"$ref":"#/channels/markPrice"},"title":"Mark price updates","summary":"Mark price per futures instrument every 5 seconds.","description":"One `MARK_PRICE_UPDATE` per instrument straight after you subscribe, then every 5 seconds on the clock. An instrument whose mark price is missing, or more than 10 seconds old, gets no message until a current one is available.","tags":[{"name":"mark-price"}],"messages":[{"$ref":"#/channels/markPrice/messages/markPriceUpdate"}]},"subscribeTrading":{"action":"receive","channel":{"$ref":"#/channels/trading"},"title":"Subscribe to TRADING","summary":"Subscribe to the TRADING channel.","description":"Send a `SUBSCRIBE` message naming `TRADING`. The server answers with a `SUBSCRIPTIONS` confirmation, or an error. You must authenticate first, with a token that has the `Trade` permission; otherwise the request is rejected with `AUTHENTICATION_REQUIRED`. The confirmation carries the `account_id` of the account your token authenticated.","security":[{"$ref":"#/components/securitySchemes/apiToken"}],"tags":[{"name":"trading"}],"messages":[{"$ref":"#/channels/trading/messages/subscribeTrading"}],"reply":{"channel":{"$ref":"#/channels/trading"},"messages":[{"$ref":"#/channels/trading/messages/tradingSubscribed"},{"$ref":"#/channels/trading/messages/subscriptionError"}]}},"createOrder":{"action":"receive","channel":{"$ref":"#/channels/trading"},"title":"Create order","summary":"Place a new order.","description":"Requires authentication and a `TRADING` subscription. A request that fails validation is answered with an error echoing the payload. A request that passes validation is booked (Order Booked), or may subsequently be rejected (Order Rejected).\n\nNothing is sent in reply to an accepted request itself: the outcome arrives as events on the `TRADING` channel. Before the request reaches the exchange, it can be refused with `AUTHENTICATION_REQUIRED`, `NOT_SUBSCRIBED_TO_TRADING_CHANNEL` or `RATE_LIMITED`; if it cannot be passed on, it is answered with `INTERNAL_ERROR`.","security":[{"$ref":"#/components/securitySchemes/apiToken"}],"tags":[{"name":"trading"}],"messages":[{"$ref":"#/channels/trading/messages/createOrder"}],"reply":{"channel":{"$ref":"#/channels/trading"},"messages":[{"$ref":"#/channels/trading/messages/orderBookedSpot"},{"$ref":"#/channels/trading/messages/orderBookedFutures"},{"$ref":"#/channels/trading/messages/orderError"},{"$ref":"#/channels/trading/messages/orderRejectedSpot"},{"$ref":"#/channels/trading/messages/orderRejectedFutures"}]},"x-docs-gap":"The error examples echo `time_in_force: \"GTC\"` while the request schema only lists the long names (`GOOD_TILL_CANCELLED`, ...); whether short codes are accepted is not documented."},"moveOrder":{"action":"receive","channel":{"$ref":"#/channels/trading"},"title":"Move order","summary":"Change the price of an open limit order.","description":"Repositions an existing limit order in the book without a full cancel and replace, in a single network packet. Only the price can be adjusted, not the amount. Identify the order by `order_id` or `client_id`.\n\nThe optional `reserve_price` set on Create Order is the maximum price the order can be moved to; a move beyond it fails with `MATCHING_MOVE_FAILED_PRICE_OVER_RISK_LIMIT`. Specifying `reserve_price` locks in that amount. It has no effect on futures instruments.\n\nMove orders are validated like Create Order requests. An error from the exchange names the order by the `order_id` or `client_id` you sent, rather than echoing the whole request in `payload`.\n\nNothing is sent in reply to an accepted request itself: the outcome arrives as an Order Moved event on the `TRADING` channel. Before the request reaches the exchange, it can be refused with `AUTHENTICATION_REQUIRED`, `NOT_SUBSCRIBED_TO_TRADING_CHANNEL` or `RATE_LIMITED`; if it cannot be passed on, it is answered with `INTERNAL_ERROR`.","security":[{"$ref":"#/components/securitySchemes/apiToken"}],"tags":[{"name":"trading"}],"messages":[{"$ref":"#/channels/trading/messages/moveOrder"}],"reply":{"channel":{"$ref":"#/channels/trading"},"messages":[{"$ref":"#/channels/trading/messages/orderMoved"},{"$ref":"#/channels/trading/messages/orderError"}]},"x-docs-gap":"The message carrying a `MATCHING_MOVE_FAILED_PRICE_OVER_RISK_LIMIT` failure is not shown. It is set by the exchange and passed through unchanged by the WebSocket server, so its shape cannot be confirmed from that server's code."},"cancelOrder":{"action":"receive","channel":{"$ref":"#/channels/trading"},"title":"Cancel order","summary":"Cancel an open order by client_id or order_id.","description":"Send `CANCEL_ORDER` with either `client_id` or `order_id`, and optionally the order's `instrument_code`. If you have created multiple orders with the same `client_id`, only the most recent is cancelled.\n\nNothing is sent in reply to an accepted request itself: the outcome arrives as an Order Closed event on the `TRADING` channel. An error from the exchange names the order by the `order_id` or `client_id` you sent. Before the request reaches the exchange, it can be refused with `AUTHENTICATION_REQUIRED`, `NOT_SUBSCRIBED_TO_TRADING_CHANNEL`, `RATE_LIMITED`, or `CLIENT_ID_ERROR` / `ORDER_ID_ERROR` for an identifier that is not a UUID; if it cannot be passed on, it is answered with `INTERNAL_ERROR`.","security":[{"$ref":"#/components/securitySchemes/apiToken"}],"tags":[{"name":"trading"}],"messages":[{"$ref":"#/channels/trading/messages/cancelOrderByClientId"},{"$ref":"#/channels/trading/messages/cancelOrderByOrderId"}],"reply":{"channel":{"$ref":"#/channels/trading"},"messages":[{"$ref":"#/channels/trading/messages/orderClosedSpot"},{"$ref":"#/channels/trading/messages/orderClosedFutures"},{"$ref":"#/channels/trading/messages/orderNotFound"},{"$ref":"#/channels/trading/messages/orderError"}]}},"cancelAllOrders":{"action":"receive","channel":{"$ref":"#/channels/trading"},"title":"Cancel all orders","summary":"Cancel all open orders, optionally for one instrument.","description":"If there are open orders, you first receive a notification that the cancellations are booked, followed by a separate Order Closed notification for each order. Passing an `instrument_code` results in even faster cancellations.\n\nThe exchange's reply, whether the booked notification or an error, is passed on exactly as the exchange sends it, without echoing your request. Before the request reaches the exchange, it can be refused with `NOT_AUTHENTICATED`, `NOT_SUBSCRIBED_TO_TRADING_CHANNEL` or `RATE_LIMITED`; if it cannot be passed on, it is answered with `INTERNAL_ERROR`.","security":[{"$ref":"#/components/securitySchemes/apiToken"}],"tags":[{"name":"trading"}],"messages":[{"$ref":"#/channels/trading/messages/cancelAllOrders"}],"reply":{"channel":{"$ref":"#/channels/trading"},"messages":[{"$ref":"#/channels/trading/messages/cancellationsBooked"},{"$ref":"#/channels/trading/messages/noOrdersToCancel"},{"$ref":"#/channels/trading/messages/orderError"}]}},"tradingEvents":{"action":"send","channel":{"$ref":"#/channels/trading"},"title":"Trading events","summary":"Order lifecycle, futures margin and balance events for your account.","description":"Pushed on the `TRADING` channel: order booked, rejected, closed, trade executed, fully filled and moved (spot and futures variants), plus futures `MARGIN_UPDATE`, minutely `SETTLEMENT`, four-hourly `FUNDING_PAYMENT`, and `BALANCE_ADJUSTMENT` on deposits and withdrawals.\n\nOrder events carry `event: ORDER` and a `status`; their `type` field is deprecated.","security":[{"$ref":"#/components/securitySchemes/apiToken"}],"tags":[{"name":"trading"}],"messages":[{"$ref":"#/channels/trading/messages/orderBookedSpot"},{"$ref":"#/channels/trading/messages/orderBookedFutures"},{"$ref":"#/channels/trading/messages/orderRejectedSpot"},{"$ref":"#/channels/trading/messages/orderRejectedFutures"},{"$ref":"#/channels/trading/messages/orderClosedSpot"},{"$ref":"#/channels/trading/messages/orderClosedFutures"},{"$ref":"#/channels/trading/messages/tradeExecutedSpot"},{"$ref":"#/channels/trading/messages/tradeExecutedFutures"},{"$ref":"#/channels/trading/messages/orderFullyFilledSpot"},{"$ref":"#/channels/trading/messages/orderFullyFilledFutures"},{"$ref":"#/channels/trading/messages/orderMoved"},{"$ref":"#/channels/trading/messages/marginUpdate"},{"$ref":"#/channels/trading/messages/settlement"},{"$ref":"#/channels/trading/messages/fundingPayment"},{"$ref":"#/channels/trading/messages/balanceAdjustment"}]},"subscribeAccount":{"action":"receive","channel":{"$ref":"#/channels/account"},"title":"Subscribe to ACCOUNT","summary":"Subscribe to the ACCOUNT channel.","description":"Send a `SUBSCRIBE` message naming `ACCOUNT`. The server answers with a `SUBSCRIPTIONS` confirmation, or an error. You must authenticate first; otherwise the request is rejected with `AUTHENTICATION_REQUIRED`. The confirmation carries the `account_id` of the account your token authenticated.","security":[{"$ref":"#/components/securitySchemes/apiToken"}],"tags":[{"name":"account"}],"messages":[{"$ref":"#/channels/account/messages/subscribeAccount"}],"reply":{"channel":{"$ref":"#/channels/account"},"messages":[{"$ref":"#/channels/account/messages/accountSubscribed"},{"$ref":"#/channels/account/messages/subscriptionError"}]}},"accountEvents":{"action":"send","channel":{"$ref":"#/channels/account"},"title":"Account events","summary":"Take profit / stop loss (TP/SL) lifecycle events.","description":"A TP/SL is held in a separate service, not on the exchange itself, so it does not appear on the TRADING channel. When one of its levels is reached, the close orders it places are ordinary orders, reported on TRADING.\n\nLifecycle: `PENDING` → `ACTIVE` → `TRIGGERED` → `COMPLETE`, and any of the first three → `CANCELLED`. `data.status` is the TP/SL's status after the event. Levels are sent as numbers; amounts are decimal strings.","security":[{"$ref":"#/components/securitySchemes/apiToken"}],"tags":[{"name":"account"}],"messages":[{"$ref":"#/channels/account/messages/exoticOrderRegistered"},{"$ref":"#/channels/account/messages/exoticOrderUpdated"},{"$ref":"#/channels/account/messages/exoticOrderActivated"},{"$ref":"#/channels/account/messages/exoticOrderTriggered"},{"$ref":"#/channels/account/messages/exoticOrderExecuted"},{"$ref":"#/channels/account/messages/exoticOrderCancelled"}]}},"components":{"securitySchemes":{"apiToken":{"type":"http","scheme":"bearer","description":"API token sent in the AUTHENTICATE message (not as a header). Generate it in the One Trading UI with the `Trade` permission; a valid token authorises all private channels for the connection."}},"schemas":{"TradingBalance":{"type":"object","title":"TradingBalance","properties":{"c":{"type":"string","description":"Currency code of the balance"},"a":{"type":"string","description":"Amount of the balance"}},"required":["c","a"]},"TimeInForce":{"title":"ExchangeTimeInForce","type":"string","description":"Time in force.","enum":["GTC","FOK","IOC","POST_ONLY"]},"OrderStatus":{"title":"OrderStatus","type":"string","description":"The order status.","enum":["OPEN","FILL","FILLED_FULLY","CANCELLED","MOVED","INSUFFICIENT_FUNDS","INSUFFICIENT_LIQUIDITY","SELF_TRADE","MOVE_SELF_TRADE","MATCHING_POST_ONLY_RESULTS_IN_MATCH","MATCHING_MOVE_FAILED_PRICE_OVER_RISK_LIMIT","RISK_MARGIN_TRADING_DISABLED","RISK_INVALID_RESERVE_BID_PRICE","RISK_FAILED_OVER_MAX_POSITION"]},"Order":{"type":"object","title":"CreateOrder","properties":{"instrument_code":{"type":"string","description":"The id of the market to create the order on. Use the /instruments endpoint to get the ids of ACTIVE markets to trade on"},"type":{"type":"string","description":"The type of order you wish to create","enum":["LIMIT"]},"side":{"type":"string","description":"BUY or SELL","enum":["BUY","SELL"]},"amount":{"type":"string","description":"The amount of currency for this order, as a positive decimal string within the instrument's amount precision"},"price":{"type":"string","description":"The price at which the order is set to execute, as a positive decimal string within the instrument's price precision and between its `min_price` and `max_price`"},"client_id":{"type":"string","format":"uuid","description":"Unique client identifier for the order. Must be a version 4 UUID. If omitted, one is generated. It is your responsibility for the uniqueness of the client_id, if you create multiple orders with the same client_id, any subsequent operation performed using this client_id will only apply to the latest"},"time_in_force":{"type":"string","description":"Defines the duration and conditions under which an order is considered valid in the market. Defaults to GOOD_TILL_CANCELLED","enum":["GOOD_TILL_CANCELLED","IMMEDIATE_OR_CANCELLED","FILL_OR_KILL","POST_ONLY"]},"reserve_price":{"type":"string","description":"Used for MOVE orders and is the max we can move to. Has no effect for futures instruments."},"take_profit":{"type":"object","description":"Take profit level attached to the order. Requires `tpsl_mode`. Unknown keys are rejected.","properties":{"value":{"type":"string","description":"The level, as a positive decimal string","pattern":"^\\d+(\\.\\d+)?$"},"type":{"type":"string","description":"The price the level is watched against. `MID`: the midpoint of the best bid and the best ask. `BBO`: the side of the book the close hits, the best bid for a long, the best ask for a short","enum":["MID","BBO"],"default":"MID"}},"required":["value"],"additionalProperties":false},"stop_loss":{"type":"object","description":"Stop loss level attached to the order. Requires `tpsl_mode`. Unknown keys are rejected.","properties":{"value":{"type":"string","description":"The level, as a positive decimal string","pattern":"^\\d+(\\.\\d+)?$"},"type":{"type":"string","description":"The price the level is watched against. `MID`: the midpoint of the best bid and the best ask. `BBO`: the side of the book the close hits, the best bid for a long, the best ask for a short","enum":["MID","BBO"],"default":"MID"}},"required":["value"],"additionalProperties":false},"tpsl_mode":{"type":"string","description":"Required when `take_profit` or `stop_loss` is sent. `order`: the TP/SL closes this order's filled amount. `position`: it closes the whole position on this instrument, as it is when a level is reached (futures only).","enum":["order","position"]},"tpsl_force":{"type":"boolean","default":false,"description":"With `tpsl_mode: position`, replace the existing position take profit / stop loss on this instrument once this order fills, instead of failing with `POSITION_TPSL_EXISTS`."},"tpsl_slippage_bps":{"type":"integer","minimum":1,"maximum":9999,"description":"How far from its level the take profit / stop loss close may trade, in basis points. At most the instrument's price collar (`price_collar_percentage` × 100 on Instruments; 1000 for an instrument without one). Defaults to 500 (5%), or the collar if that is less. It cannot be changed later."}},"required":["instrument_code","type","side","amount","price"]},"Authenticate":{"type":"object","title":"AuthenticateRequest","properties":{"type":{"type":"string","const":"AUTHENTICATE"},"api_token":{"type":"string","description":"API token generated on the UI with Trade permissions"}},"required":["type","api_token"]},"Authenticated":{"type":"object","title":"AuthenticateSuccessResponse","properties":{"type":{"type":"string","const":"AUTHENTICATED"}},"required":["type"]},"AuthenticationFailed":{"type":"object","title":"AuthenticateErrorResponse","properties":{"error":{"type":"string","description":"Why the token was rejected. `AUTH_ERROR`: the token is missing, invalid or not accepted. `ACCOUNT_RESTRICTED`: the account the token belongs to is restricted. Either way, the server then closes the connection with close code `3000`.","enum":["AUTH_ERROR","ACCOUNT_RESTRICTED"]}},"required":["error"]},"Subscribe":{"type":"object","title":"SubscriptionRequest","properties":{"type":{"type":"string","const":"SUBSCRIBE"},"channels":{"type":"array","minItems":1,"maxItems":1,"items":{"type":"object","properties":{"name":{"type":"string","description":"Channel name to subscribe to","enum":["ORDER_BOOK","PRICE_TICKS","BOOK_TICKER","MARK_PRICE","TRADING","ACCOUNT"]},"instrument_codes":{"type":"array","items":{"type":"string"},"description":"A list of market ids. Required for `ORDER_BOOK`, `PRICE_TICKS` and `BOOK_TICKER`; optional for `MARK_PRICE`; not used by `TRADING` and `ACCOUNT`."}},"required":["name"]}}},"required":["type","channels"]},"Subscriptions":{"type":"object","title":"SubscriptionSuccessResponse","properties":{"type":{"type":"string","const":"SUBSCRIPTIONS"},"channels":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"Channel name subscribed to","enum":["ORDER_BOOK","PRICE_TICKS","BOOK_TICKER","MARK_PRICE","TRADING","ACCOUNT"]},"instrument_codes":{"type":"array","items":{"type":"string"},"description":"The instrument codes from the request, without duplicates. Sent for channels that take `instrument_codes`."},"account_id":{"type":"string","description":"Private channels (`TRADING`, `ACCOUNT`) only. The account your token authenticated."}},"required":["name"]}},"time":{"type":"integer","format":"int64","description":"The time the message was sent in nanoseconds"}},"required":["type","channels","time"]},"SubscriptionError":{"type":"object","title":"SubscriptionErrorResponse","properties":{"channel_name":{"type":"string","description":"The channel the request named. Sent with `INVALID_INSTRUMENT_CODES_LIST` and `INVALID_INSTRUMENT_CODES` only."},"error":{"type":"string","description":"The reason the subscription failed.","enum":["INVALID_CHANNEL","INVALID_MESSAGE_FORMAT","AUTHENTICATION_REQUIRED","INVALID_INSTRUMENT_CODES_LIST","INVALID_INSTRUMENT_CODES"]},"invalid_instruments":{"type":"array","items":{"type":"string"},"description":"`INVALID_INSTRUMENT_CODES` only. The instrument codes that were not recognised."}},"required":["error"]},"Unsubscribe":{"type":"object","title":"UnsubscribeRequest","properties":{"type":{"type":"string","const":"UNSUBSCRIBE"},"channels":{"type":"array","minItems":1,"items":{"type":"string","description":"Name of a channel to unsubscribe from.","enum":["ORDER_BOOK","PRICE_TICKS","BOOK_TICKER","MARK_PRICE","TRADING","ACCOUNT"]},"description":"The channels to leave, as plain channel names. Unlike `SUBSCRIBE`, several can be named in one message."}},"required":["type","channels"]},"Unsubscribed":{"type":"object","title":"UnsubscribeSuccessResponse","properties":{"type":{"type":"string","const":"UNSUBSCRIBED"},"channel_name":{"type":"string","description":"The channel you have left. One `UNSUBSCRIBED` is sent per channel named in the request."}},"required":["type","channel_name"]},"UnsubscribeError":{"type":"object","title":"UnsubscribeErrorResponse","properties":{"type":{"type":"string","const":"UNSUBSCRIBE_ERROR"},"channel_name":{"type":"string","description":"The channel that could not be unsubscribed, such as an unknown name."}},"required":["type","channel_name"]},"Heartbeat":{"type":"object","title":"Heartbeat","properties":{"channel_name":{"type":"string","const":"SYSTEM","description":"`SYSTEM`."},"subscription":{"type":"string","const":"SYSTEM","description":"`SYSTEM`."},"time":{"type":"integer","format":"int64","description":"Time the heartbeat was sent, in nanoseconds. Stamped by the WebSocket server, so it may be up to 1 second out."},"type":{"type":"string","const":"HEARTBEAT"}},"required":["channel_name","subscription","time","type"]},"SubscribeOrderBook":{"type":"object","title":"SubscriptionRequest","properties":{"type":{"type":"string","const":"SUBSCRIBE"},"channels":{"type":"array","minItems":1,"maxItems":1,"items":{"type":"object","properties":{"name":{"type":"string","const":"ORDER_BOOK","description":"Channel name to subscribe to"},"instrument_codes":{"type":"array","minItems":1,"items":{"type":"string"},"description":"The markets to receive. Required. Leaving it out is rejected with `INVALID_CHANNEL`, an empty list with `INVALID_INSTRUMENT_CODES_LIST`, and unknown codes with `INVALID_INSTRUMENT_CODES`."}},"required":["name","instrument_codes"]}}},"required":["type","channels"]},"OrderBookSubscribed":{"type":"object","title":"SubscriptionConfirmation","properties":{"type":{"type":"string","const":"SUBSCRIPTIONS"},"channels":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","const":"ORDER_BOOK","description":"Name of the channel which has just been subscribed to."},"instrument_codes":{"type":"array","items":{"type":"string","description":"Instrument code"},"description":"Optional list of instrument codes to receive events for."}},"required":["name"]}},"time":{"type":"integer","format":"int64","description":"Time the message was sent from the server in nanoseconds."}},"required":["type","channels","time"]},"OrderBookSnapshot":{"type":"object","title":"OrderbookSnapshot","properties":{"channel_name":{"type":"string","const":"ORDER_BOOK"},"type":{"type":"string","const":"ORDER_BOOK_SNAPSHOT"},"time":{"type":"integer","format":"int64","description":"Time in nanoseconds the exchange took the snapshot. This is not when the message was sent, and on a quiet market it can be some seconds old."},"instrument_code":{"type":"string","description":"The instrument the book belongs to."},"asks":{"type":"array","description":"Ask levels, each a `[price, amount]` pair.","items":{"type":"array","items":[{"type":"string","description":"PRICE"},{"type":"string","description":"AMOUNT"}],"minItems":2,"maxItems":2}},"bids":{"type":"array","description":"Bid levels, each a `[price, amount]` pair.","items":{"type":"array","items":[{"type":"string","description":"PRICE"},{"type":"string","description":"AMOUNT"}],"minItems":2,"maxItems":2}},"unum_bids":{"type":"integer","format":"int64","description":"Sequence number of the bid side that the snapshot is current to. The first update to apply after it has `unum_bids` 1 higher."},"unum_asks":{"type":"integer","format":"int64","description":"Sequence number of the ask side that the snapshot is current to. The first update to apply after it has `unum_asks` 1 higher."}},"required":["channel_name","type","time","instrument_code","asks","bids","unum_bids","unum_asks"]},"OrderBookUpdate":{"type":"object","title":"OrderbookUpdate","properties":{"channel_name":{"type":"string","const":"ORDER_BOOK"},"type":{"type":"string","const":"ORDER_BOOK_UPDATE"},"time":{"type":"integer","format":"int64","description":"Time in nanoseconds of the update"},"instrument_code":{"type":"string"},"changes":{"type":"array","items":{"type":"array","items":[{"type":"string","description":"SIDE","enum":["BUY","SELL"]},{"type":"string","description":"PRICE"},{"type":"string","description":"AMOUNT. `0` means the price level has been removed from the order book."}],"minItems":3,"maxItems":3}},"unum_bids":{"type":"integer","format":"int64","description":"Sequence number of the bid side after this update. Each update raises it by exactly 1; apply the update only when it is 1 more than the value you last held."},"unum_asks":{"type":"integer","format":"int64","description":"Sequence number of the ask side after this update. Each update raises it by exactly 1; apply the update only when it is 1 more than the value you last held."}},"required":["channel_name","type","time","instrument_code","changes","unum_bids","unum_asks"]},"SubscribePriceTicks":{"type":"object","title":"SubscriptionRequest","properties":{"type":{"type":"string","const":"SUBSCRIBE"},"channels":{"type":"array","minItems":1,"maxItems":1,"items":{"type":"object","properties":{"name":{"type":"string","const":"PRICE_TICKS","description":"Channel name to subscribe to"},"instrument_codes":{"type":"array","minItems":1,"items":{"type":"string"},"description":"The markets to receive. Required. Leaving it out is rejected with `INVALID_CHANNEL`, an empty list with `INVALID_INSTRUMENT_CODES_LIST`, and unknown codes with `INVALID_INSTRUMENT_CODES`."}},"required":["name","instrument_codes"]}}},"required":["type","channels"]},"PriceTicksSubscribed":{"type":"object","title":"SubscriptionConfirmation","properties":{"type":{"type":"string","const":"SUBSCRIPTIONS"},"channels":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","const":"PRICE_TICKS","description":"Name of the channel which has just been subscribed to."},"instrument_codes":{"type":"array","items":{"type":"string","description":"Instrument code"},"description":"Optional list of instrument codes to receive events for."}},"required":["name"]}},"time":{"type":"integer","format":"int64","description":"Time the message was sent from the server in nanoseconds."}},"required":["type","channels","time"]},"PriceTick":{"type":"object","title":"PriceTick","properties":{"channel_name":{"type":"string","const":"PRICE_TICKS"},"type":{"type":"string","const":"PRICE_TICK"},"time":{"type":"integer","format":"int64","description":"Time in nanoseconds the trade was executed"},"instrument_code":{"type":"string"},"price":{"type":"string"},"amount":{"type":"string"},"volume":{"type":"string"},"best_bid":{"type":"string"},"best_ask":{"type":"string"},"taker_side":{"type":"string","enum":["BUY","SELL"]}},"required":["channel_name","type","time","instrument_code","price","amount","volume","best_bid","best_ask","taker_side"]},"PriceTickHistory":{"type":"object","title":"PriceTickHistory","properties":{"channel_name":{"type":"string","const":"PRICE_TICKS"},"type":{"type":"string","const":"PRICE_TICK_HISTORY"},"time":{"type":"integer","format":"int64","description":"Time in nanoseconds the message was sent."},"instrument_code":{"type":"string","description":"The instrument the ticks belong to."},"history":{"type":"array","maxItems":80,"description":"Up to the 80 most recent ticks for the instrument, oldest first. Empty when no history is available.","items":{"type":"object","properties":{"time":{"type":"integer","format":"int64","description":"Time in nanoseconds the trade was executed"},"instrument_code":{"type":"string"},"price":{"type":"string"},"amount":{"type":"string"},"volume":{"type":"string"},"best_bid":{"type":"string"},"best_ask":{"type":"string"},"taker_side":{"type":"string","enum":["BUY","SELL"]}},"required":["time","instrument_code","price","amount","volume","best_bid","best_ask","taker_side"]}}},"required":["channel_name","type","time","instrument_code","history"]},"SubscribeBookTicker":{"type":"object","title":"SubscriptionRequest","properties":{"type":{"type":"string","const":"SUBSCRIBE"},"channels":{"type":"array","minItems":1,"maxItems":1,"items":{"type":"object","properties":{"name":{"type":"string","const":"BOOK_TICKER","description":"Channel name to subscribe to"},"instrument_codes":{"type":"array","minItems":1,"items":{"type":"string"},"description":"The markets to receive. Required. A missing or empty list is rejected with `INVALID_INSTRUMENT_CODES_LIST`, and unknown codes with `INVALID_INSTRUMENT_CODES`."}},"required":["name","instrument_codes"]}}},"required":["type","channels"]},"BookTickerSubscribed":{"type":"object","title":"SubscriptionConfirmation","properties":{"type":{"type":"string","const":"SUBSCRIPTIONS"},"channels":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","const":"BOOK_TICKER","description":"Name of the channel which has just been subscribed to."},"instrument_codes":{"type":"array","items":{"type":"string","description":"Instrument code"},"description":"The instrument codes from the request, without duplicates."}},"required":["name"]}},"time":{"type":"integer","format":"int64","description":"Time the message was sent from the server in nanoseconds."}},"required":["type","channels","time"]},"BookTick":{"type":"object","title":"BookTick","properties":{"channel_name":{"type":"string","const":"BOOK_TICKER"},"type":{"type":"string","const":"BOOK_TICK"},"time":{"type":"integer","format":"int64","description":"Time in nanoseconds the message was sent"},"instrument_code":{"type":"string"},"data":{"type":"object","properties":{"best_bid":{"type":"string"},"bid_amount":{"type":"string"},"best_ask":{"type":"string"},"ask_amount":{"type":"string"}},"required":["best_bid","bid_amount","best_ask","ask_amount"]}},"required":["channel_name","type","time","instrument_code","data"]},"BookTickerSnapshot":{"type":"object","title":"BookTickerSnapshot","properties":{"channel_name":{"type":"string","const":"BOOK_TICKER"},"type":{"type":"string","const":"BOOK_TICKER_SNAPSHOT"},"time":{"type":"integer","format":"int64","description":"Time in nanoseconds the message was sent"},"instrument_code":{"type":"string","description":"The instrument the top of the book belongs to."},"data":{"type":"object","description":"The current top of the book, in the same shape as `BOOK_TICK`.","properties":{"best_bid":{"type":"string","description":"Best bid price. `\"0\"` when there are no bids."},"bid_amount":{"type":"string","description":"Amount at the best bid. `\"0\"` when there are no bids."},"best_ask":{"type":"string","description":"Best ask price. `\"0\"` when there are no asks."},"ask_amount":{"type":"string","description":"Amount at the best ask. `\"0\"` when there are no asks."}},"required":["best_bid","bid_amount","best_ask","ask_amount"]}},"required":["channel_name","type","time","instrument_code","data"]},"SubscribeMarkPrice":{"type":"object","title":"SubscriptionRequest","properties":{"type":{"type":"string","const":"SUBSCRIBE"},"channels":{"type":"array","minItems":1,"maxItems":1,"items":{"type":"object","properties":{"name":{"type":"string","const":"MARK_PRICE","description":"Channel name to subscribe to"},"instrument_codes":{"type":"array","minItems":1,"items":{"type":"string"},"description":"Optional. Futures instrument codes (e.g. `BTC_USD_P`) only; a spot instrument code is rejected. Leave the field out to receive the mark price of every futures instrument. An empty list is rejected with `INVALID_INSTRUMENT_CODES_LIST`."}},"required":["name"]}}},"required":["type","channels"]},"MarkPriceSubscribed":{"type":"object","title":"SubscriptionConfirmation","properties":{"type":{"type":"string","const":"SUBSCRIPTIONS"},"channels":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","const":"MARK_PRICE","description":"Name of the channel which has just been subscribed to."},"instrument_codes":{"type":"array","items":{"type":"string","description":"Instrument code"},"description":"Optional list of instrument codes to receive events for."}},"required":["name"]}},"time":{"type":"integer","format":"int64","description":"Time the message was sent from the server in nanoseconds."}},"required":["type","channels","time"]},"UpdateMarkPriceSubscription":{"type":"object","title":"UpdateSubscriptionRequest","properties":{"type":{"type":"string","const":"UPDATE_SUBSCRIPTION"},"channels":{"type":"array","minItems":1,"maxItems":1,"items":{"type":"object","properties":{"name":{"type":"string","const":"MARK_PRICE"},"instrument_codes":{"type":"array","minItems":1,"items":{"type":"string"},"description":"Optional. Futures instrument codes (e.g. `BTC_USD_P`) only; a spot instrument code is rejected. Leave the field out to receive the mark price of every futures instrument. An empty list is rejected with `INVALID_INSTRUMENT_CODES_LIST`."}},"required":["name"]}}},"required":["type","channels"]},"MarkPriceSubscriptionUpdated":{"type":"object","title":"SubscriptionUpdated","properties":{"type":{"type":"string","const":"SUBSCRIPTION_UPDATED"},"channel_name":{"type":"string","const":"MARK_PRICE"}},"required":["type","channel_name"]},"MarkPriceError":{"type":"object","title":"MarkPriceError","properties":{"channel_name":{"type":"string","const":"MARK_PRICE"},"error":{"type":"string","description":"Why the request was rejected.","enum":["INVALID_INSTRUMENT_CODES_LIST","INVALID_INSTRUMENT_CODES"]},"invalid_instruments":{"type":"array","items":{"type":"string"},"description":"The unknown or spot instrument codes (`INVALID_INSTRUMENT_CODES`)."}},"required":["channel_name","error"]},"MarkPriceUpdate":{"type":"object","title":"MarkPriceUpdate","properties":{"channel_name":{"type":"string","const":"MARK_PRICE","description":"`MARK_PRICE`."},"time":{"type":"integer","format":"int64","description":"Nanosecond timestamp of when the message was sent."},"type":{"type":"string","const":"MARK_PRICE_UPDATE","description":"`MARK_PRICE_UPDATE`."},"instrument_code":{"type":"string","description":"The futures instrument, e.g. `BTC_USD_P`."},"data":{"type":"object","properties":{"time":{"type":"integer","format":"int64","description":"Nanosecond timestamp of when the mark price was calculated."},"mark_price":{"type":"string","description":"The mark price."},"index_price":{"type":["string","null"],"description":"The index price behind the mark. `null` when no live index is available."},"tier":{"type":"string","description":"How the mark was priced: `ANCHORED`, `THIN` or `VENUE`. A `VENUE` mark comes from the venue's own prices, with no index behind it.","enum":["ANCHORED","THIN","VENUE"]},"session":{"type":"boolean","description":"`false` while the underlying's primary market is outside its regular trading hours."}},"required":["time","mark_price","index_price","tier","session"]}},"required":["channel_name","time","type","instrument_code","data"]},"SubscribeTrading":{"type":"object","title":"SubscriptionRequest","properties":{"type":{"type":"string","const":"SUBSCRIBE"},"channels":{"type":"array","minItems":1,"maxItems":1,"items":{"type":"object","properties":{"name":{"type":"string","const":"TRADING","description":"Channel name to subscribe to"}},"required":["name"]}}},"required":["type","channels"]},"TradingSubscribed":{"type":"object","title":"SubscriptionConfirmation","properties":{"type":{"type":"string","const":"SUBSCRIPTIONS"},"channels":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","const":"TRADING","description":"Name of the channel which has just been subscribed to."},"account_id":{"type":"string","description":"The account your token authenticated, whose trading activity the channel carries."}},"required":["name","account_id"]}},"time":{"type":"integer","format":"int64","description":"Time the message was sent from the server in nanoseconds."}},"required":["type","channels","time"]},"CreateOrder":{"type":"object","title":"CreateOrderRequest","properties":{"type":{"type":"string","const":"CREATE_ORDER"},"order":{"$ref":"#/components/schemas/Order"}},"required":["type","order"]},"MoveOrder":{"type":"object","title":"MoveOrderRequest","properties":{"type":{"type":"string","const":"MOVE_ORDER"},"order":{"type":"object","properties":{"order_id":{"type":"string","format":"uuid","description":"Required if `client_id` not provided. The order_id of the order to move."},"client_id":{"type":"string","format":"uuid","description":"Required if `order_id` not provided. The client_id of the order to move."},"instrument_code":{"type":"string","description":"The instrument code of the order to move"},"price":{"type":"string","description":"The price to move the order to."}},"required":["instrument_code","price"]}},"required":["type","order"]},"CancelOrderByClientId":{"type":"object","title":"CancelOrderClientIdRequest","properties":{"type":{"type":"string","const":"CANCEL_ORDER"},"client_id":{"type":"string","format":"uuid","description":"Unique client id of the order to cancel"},"instrument_code":{"type":"string","description":"Optional. The instrument code of the order to cancel."}},"required":["type","client_id"]},"CancelOrderByOrderId":{"type":"object","title":"CancelOrderOrderIdRequest","properties":{"type":{"type":"string","const":"CANCEL_ORDER"},"order_id":{"type":"string","format":"uuid","description":"Unique order id of the order to cancel"},"instrument_code":{"type":"string","description":"Optional. The instrument code of the order to cancel."}},"required":["type","order_id"]},"CancelAllOrders":{"type":"object","title":"CancelAllOrdersRequest","properties":{"type":{"type":"string","const":"CANCEL_ALL_ORDERS"},"instrument_code":{"type":"string","description":"Optional instrument code to cancel orders only on this market."}},"required":["type"]},"OrderError":{"type":"object","title":"OrderErrorResponse","properties":{"error":{"type":"string","description":"The reason the request was rejected","enum":["PRICE_PRECISION_FIELD_ERROR","AMOUNT_PRECISION_FIELD_ERROR","CLIENT_ID_ERROR","ORDER_ID_ERROR","TIME_IN_FORCE_ERROR","ORDER_TYPE_NOT_SUPPORTED_ERROR","PAIR_ERROR","UNSUPPORTED_COMMAND","INVALID_FORMAT","PRICE_FORMAT_ERROR","QUANTITY_FORMAT_ERROR","MAX_OPEN_ORDERS_EXCEEDED","ORDER_NOT_FOUND","MAX_ORDER_SIZE_EXCEEDED","MIN_NOTIONAL_ERROR","TYPE_FIELD_NOT_FIRST","MIN_PRICE_EXCEEDED_ERROR","MAX_PRICE_EXCEEDED_ERROR","SUSPENDED_PAIR","PRICE_OUT_OF_COLLAR_ERROR","MAX_ORDER_VOLUME_ERROR","MAX_ORDER_VALUE_ERROR","ONLY_POST_ONLY_ALLOWED_ERROR","AUTHENTICATION_REQUIRED","NOT_AUTHENTICATED","NOT_SUBSCRIBED_TO_TRADING_CHANNEL","RATE_LIMITED","INTERNAL_ERROR"]},"payload":{"type":"object","description":"The request that resulted in the error. Sent with validation errors on `CREATE_ORDER`, with `CLIENT_ID_ERROR` and `ORDER_ID_ERROR` on `CANCEL_ORDER`, and with `INTERNAL_ERROR`."},"order_id":{"type":"string","format":"uuid","description":"`MOVE_ORDER` and `CANCEL_ORDER` errors from the exchange: the `order_id` from the request, when the order was named by it."},"client_id":{"type":"string","format":"uuid","description":"`MOVE_ORDER` and `CANCEL_ORDER` errors from the exchange: the `client_id` from the request, when the order was named by it."},"message":{"type":"string","const":"TOO_MANY_REQUESTS","description":"`RATE_LIMITED` only."},"details":{"type":"string","description":"`RATE_LIMITED` only. The limit that applies to your account, e.g. `Current limit is 600 per minute`."}},"required":["error"]},"OrderNotFound":{"type":"object","title":"OrderNotFound","properties":{"error":{"type":"string","const":"ORDER_NOT_FOUND"},"client_id":{"type":"string","format":"uuid","description":"The client_id from the request, when cancelling by client ID."},"order_id":{"type":"string","format":"uuid","description":"The order_id from the request, when cancelling by order ID."}},"required":["error"]},"NoOrdersToCancel":{"type":"object","title":"NoOrdersToCancel","properties":{"error":{"type":"string","description":"Free-text error."}},"required":["error"]},"CancellationsBooked":{"type":"object","title":"CancellationsBooked","properties":{"channel_name":{"type":"string","const":"TRADING"},"type":{"type":"string","const":"BOOKED"},"details":{"type":"string","description":"Human-readable summary, e.g. how many orders are being cancelled."}},"required":["channel_name","type","details"]},"OrderBookedSpot":{"title":"SpotBookedOrder","type":"object","properties":{"channel_name":{"type":"string","const":"TRADING","description":"The name of the WebSocket channel, always `TRADING`."},"type":{"type":"string","const":"BOOKED","description":"This field is deprecated and will be removed soon, please use the `event` and `status` fields.","deprecated":true},"event":{"type":"string","const":"ORDER","description":"The event type this message relates to."},"status":{"$ref":"#/components/schemas/OrderStatus"},"order_book_sequence":{"type":"integer","format":"int64","description":"The order book sequence number."},"side":{"type":"string","description":"`BUY` or `SELL`","enum":["BUY","SELL"]},"amount":{"type":"string","description":"The amount for the order."},"price":{"type":"string","description":"The price the order was booked at."},"instrument_code":{"type":"string","description":"The instrument code of the market."},"tif":{"$ref":"#/components/schemas/TimeInForce"},"client_id":{"type":"string","format":"uuid","description":"The client provided, or system generated client id."},"order_id":{"type":"string","format":"uuid","description":"The system generated order id."},"time":{"type":"integer","format":"int64","description":"Nanosecond timestamp the order was accepted into the order book"},"bals":{"type":"array","items":{"$ref":"#/components/schemas/TradingBalance"},"description":"Available balances for the currencies concerned with this market."},"lckd_bals":{"type":"array","items":{"$ref":"#/components/schemas/TradingBalance"},"description":"Locked balances for the currencies concerned with this market."}},"required":["channel_name","type","event","status","order_book_sequence","side","amount","instrument_code","client_id","order_id","time","bals","price","tif","lckd_bals"]},"OrderBookedFutures":{"title":"FuturesBookedOrder","type":"object","properties":{"channel_name":{"type":"string","const":"TRADING","description":"The name of the WebSocket channel, always `TRADING`."},"type":{"type":"string","const":"BOOKED","description":"This field is deprecated and will be removed soon, please use the `event` and `status` fields.","deprecated":true},"event":{"type":"string","const":"ORDER","description":"The event type this message relates to."},"status":{"$ref":"#/components/schemas/OrderStatus"},"order_book_sequence":{"type":"integer","format":"int64","description":"The order book sequence number."},"side":{"type":"string","description":"`BUY` or `SELL`","enum":["BUY","SELL"]},"amount":{"type":"string","description":"The amount for the order."},"price":{"type":"string","description":"The price the order was booked at."},"instrument_code":{"type":"string","description":"The instrument code of the market."},"tif":{"$ref":"#/components/schemas/TimeInForce"},"client_id":{"type":"string","format":"uuid","description":"The client provided, or system generated client id."},"order_id":{"type":"string","format":"uuid","description":"The system generated order id."},"time":{"type":"integer","format":"int64","description":"Nanosecond timestamp the order was accepted into the order book"},"uid":{"type":"integer","format":"int64"},"margin_used":{"type":"string","description":"The total margin used in your futures account, expressed in quote currency."},"liquidation":{"type":"boolean","description":"Present and `true` if the trade was part of a liquidation event."},"bals":{"type":"array","items":{"$ref":"#/components/schemas/TradingBalance"},"description":"An array containing your account balance (equity) after the order has been booked. In this cash-settled futures account, the array will typically contain a single entry representing your balance in the settlement currency (EUR)."}},"required":["channel_name","type","event","status","order_book_sequence","side","amount","instrument_code","client_id","order_id","time","bals","price","tif","margin_used"]},"OrderRejectedSpot":{"title":"SpotRejectedOrder","type":"object","properties":{"channel_name":{"type":"string","const":"TRADING","description":"The name of the WebSocket channel, always `TRADING`."},"type":{"type":"string","const":"DONE","description":"This field is deprecated and will be removed soon, please use the `event` and `status` fields.","deprecated":true},"event":{"type":"string","const":"ORDER","description":"The event type this message relates to."},"status":{"description":"The reason the order was rejected.","allOf":[{"$ref":"#/components/schemas/OrderStatus"}]},"order_book_sequence":{"type":"integer","format":"int64","description":"The order book sequence number."},"side":{"type":"string","description":"`BUY` or `SELL`","enum":["BUY","SELL"]},"amount":{"type":"string","description":"The amount for the order."},"price":{"type":"string","description":"The price the order was booked at."},"instrument_code":{"type":"string","description":"The instrument code of the market."},"tif":{"$ref":"#/components/schemas/TimeInForce"},"client_id":{"type":"string","format":"uuid","description":"The client provided, or system generated client id."},"order_id":{"type":"string","format":"uuid","description":"The system generated order id."},"time":{"type":"integer","format":"int64","description":"Nanosecond timestamp the order was accepted into the order book"},"remaining":{"type":"string","description":"The amount remaining for this order, always `0` for rejected orders."},"bals":{"type":"array","items":{"$ref":"#/components/schemas/TradingBalance"},"description":"Available balances for the currencies concerned with this market."},"lckd_bals":{"type":"array","items":{"$ref":"#/components/schemas/TradingBalance"},"description":"Locked balances for the currencies concerned with this market."}},"required":["channel_name","type","event","status","order_book_sequence","side","amount","instrument_code","client_id","order_id","time","bals","price","tif","remaining","lckd_bals"]},"OrderRejectedFutures":{"title":"FuturesRejectedOrder","type":"object","properties":{"channel_name":{"type":"string","const":"TRADING","description":"The name of the WebSocket channel, always `TRADING`."},"type":{"type":"string","const":"DONE","description":"This field is deprecated and will be removed soon, please use the `event` and `status` fields.","deprecated":true},"event":{"type":"string","const":"ORDER","description":"The event type this message relates to."},"status":{"description":"The reason the order was rejected.","allOf":[{"$ref":"#/components/schemas/OrderStatus"}]},"order_book_sequence":{"type":"integer","format":"int64","description":"The order book sequence number."},"side":{"type":"string","description":"`BUY` or `SELL`","enum":["BUY","SELL"]},"amount":{"type":"string","description":"The amount for the order."},"price":{"type":"string","description":"The price the order was booked at."},"instrument_code":{"type":"string","description":"The instrument code of the market."},"tif":{"$ref":"#/components/schemas/TimeInForce"},"client_id":{"type":"string","format":"uuid","description":"The client provided, or system generated client id."},"order_id":{"type":"string","format":"uuid","description":"The system generated order id."},"time":{"type":"integer","format":"int64","description":"Nanosecond timestamp the order was accepted into the order book"},"remaining":{"type":"string","description":"The amount remaining for this order, always `0` for rejected orders."},"margin_used":{"type":"string","description":"The total margin used in your futures account, expressed in quote currency."},"liquidation":{"type":"boolean","description":"Present and `true` if the trade was part of a liquidation event."},"bals":{"type":"array","items":{"$ref":"#/components/schemas/TradingBalance"},"description":"An array containing your account balance (equity) after the order has been booked. In this cash-settled futures account, the array will typically contain a single entry representing your balance in the settlement currency (EUR)."}},"required":["channel_name","type","event","status","order_book_sequence","side","amount","instrument_code","client_id","order_id","time","bals","price","tif","remaining","margin_used"]},"OrderClosedSpot":{"title":"SpotClosedOrder","type":"object","properties":{"channel_name":{"type":"string","const":"TRADING","description":"The name of the WebSocket channel, always `TRADING`."},"type":{"type":"string","const":"DONE","description":"This field is deprecated and will be removed soon, please use the `event` and `status` fields.","deprecated":true},"event":{"type":"string","const":"ORDER","description":"The event type this message relates to."},"status":{"$ref":"#/components/schemas/OrderStatus"},"order_book_sequence":{"type":"integer","format":"int64","description":"The order book sequence number."},"side":{"type":"string","description":"`BUY` or `SELL`","enum":["BUY","SELL"]},"amount":{"type":"string","description":"The amount for the order."},"price":{"type":"string","description":"The price the order was booked at."},"instrument_code":{"type":"string","description":"The instrument code of the market."},"tif":{"$ref":"#/components/schemas/TimeInForce"},"client_id":{"type":"string","format":"uuid","description":"The client provided, or system generated client id."},"order_id":{"type":"string","format":"uuid","description":"The system generated order id."},"time":{"type":"integer","format":"int64","description":"Nanosecond timestamp the order was accepted into the order book"},"remaining":{"type":"string","description":"The amount remaining for this order at the time of closure."},"bals":{"type":"array","items":{"$ref":"#/components/schemas/TradingBalance"},"description":"Available balances for the currencies concerned with this market."},"lckd_bals":{"type":"array","items":{"$ref":"#/components/schemas/TradingBalance"},"description":"Locked balances for the currencies concerned with this market."}},"required":["channel_name","type","event","status","order_book_sequence","side","amount","instrument_code","client_id","order_id","time","bals","price","remaining","lckd_bals"]},"OrderClosedFutures":{"title":"FuturesClosedOrder","type":"object","properties":{"channel_name":{"type":"string","const":"TRADING","description":"The name of the WebSocket channel, always `TRADING`."},"type":{"type":"string","const":"DONE","description":"This field is deprecated and will be removed soon, please use the `event` and `status` fields.","deprecated":true},"event":{"type":"string","const":"ORDER","description":"The event type this message relates to."},"status":{"$ref":"#/components/schemas/OrderStatus"},"order_book_sequence":{"type":"integer","format":"int64","description":"The order book sequence number."},"side":{"type":"string","description":"`BUY` or `SELL`","enum":["BUY","SELL"]},"amount":{"type":"string","description":"The amount for the order."},"price":{"type":"string","description":"The price the order was booked at."},"instrument_code":{"type":"string","description":"The instrument code of the market."},"tif":{"$ref":"#/components/schemas/TimeInForce"},"client_id":{"type":"string","format":"uuid","description":"The client provided, or system generated client id."},"order_id":{"type":"string","format":"uuid","description":"The system generated order id."},"time":{"type":"integer","format":"int64","description":"Nanosecond timestamp the order was accepted into the order book"},"remaining":{"type":"string","description":"The amount remaining for this order at the time of closure."},"margin_used":{"type":"string","description":"The total margin used in your futures account, expressed in quote currency."},"liquidation":{"type":"boolean","description":"Present and `true` if the trade was part of a liquidation event."},"bals":{"type":"array","items":{"$ref":"#/components/schemas/TradingBalance"},"description":"An array containing your account balance (equity) after the order has been booked. In this cash-settled futures account, the array will typically contain a single entry representing your balance in the settlement currency (EUR)."}},"required":["channel_name","type","event","status","order_book_sequence","side","amount","instrument_code","client_id","order_id","time","bals","price","remaining","margin_used"]},"TradeExecutedSpot":{"title":"SpotTradeExecuted","type":"object","properties":{"channel_name":{"type":"string","const":"TRADING","description":"The name of the WebSocket channel, always `TRADING`."},"type":{"type":"string","const":"FILL","description":"This field is deprecated and will be removed soon, please use the `event` and `status` fields.","deprecated":true},"event":{"type":"string","const":"ORDER","description":"The event type this message relates to."},"status":{"$ref":"#/components/schemas/OrderStatus"},"order_book_sequence":{"type":"integer","format":"int64","description":"The order book sequence number."},"side":{"type":"string","description":"`BUY` or `SELL`","enum":["BUY","SELL"]},"amount":{"type":"string","description":"The amount for the order."},"instrument_code":{"type":"string","description":"The instrument code of the market."},"tif":{"$ref":"#/components/schemas/TimeInForce"},"client_id":{"type":"string","format":"uuid","description":"The client provided, or system generated client id."},"order_id":{"type":"string","format":"uuid","description":"The system generated order id."},"time":{"type":"integer","format":"int64","description":"Nanosecond timestamp the order was accepted into the order book"},"remaining":{"type":"string","description":"The amount remaining for this order."},"trade_id":{"type":"string","format":"uuid","description":"The system generated trade id."},"matched_as":{"type":"string","description":"`MAKER` or `TAKER`","enum":["MAKER","TAKER"]},"matched_amount":{"type":"string","description":"How much of the order was matched with this trade."},"matched_price_avg":{"type":"string","description":"The average price at which the order was filled."},"cum_quote_amount":{"type":"string","description":"The cumulative quote currency amount for the filled portion of the order."},"fee":{"type":"string","description":"The amount taken as fee for this trade"},"fee_currency":{"type":"string","description":"The currency in which the fee was charged. `BUY` orders will be charged fees in the base currency, `SELL` orders will be charged the fee in the quote currency."},"bals":{"type":"array","items":{"$ref":"#/components/schemas/TradingBalance"},"description":"Available balances for the currencies concerned with this market."},"lckd_bals":{"type":"array","items":{"$ref":"#/components/schemas/TradingBalance"},"description":"Locked balances for the currencies concerned with this market."}},"required":["channel_name","type","event","status","order_book_sequence","side","amount","instrument_code","client_id","order_id","time","bals","remaining","trade_id","matched_as","matched_amount","matched_price_avg","cum_quote_amount","fee","fee_currency","lckd_bals"]},"TradeExecutedFutures":{"title":"FuturesTradeExecuted","type":"object","properties":{"channel_name":{"type":"string","const":"TRADING","description":"The name of the WebSocket channel, always `TRADING`."},"type":{"type":"string","const":"FILL","description":"This field is deprecated and will be removed soon, please use the `event` and `status` fields.","deprecated":true},"event":{"type":"string","const":"ORDER","description":"The event type this message relates to."},"status":{"$ref":"#/components/schemas/OrderStatus"},"order_book_sequence":{"type":"integer","format":"int64","description":"The order book sequence number."},"side":{"type":"string","description":"`BUY` or `SELL`","enum":["BUY","SELL"]},"amount":{"type":"string","description":"The amount for the order."},"instrument_code":{"type":"string","description":"The instrument code of the market."},"tif":{"$ref":"#/components/schemas/TimeInForce"},"client_id":{"type":"string","format":"uuid","description":"The client provided, or system generated client id."},"order_id":{"type":"string","format":"uuid","description":"The system generated order id."},"time":{"type":"integer","format":"int64","description":"Nanosecond timestamp the order was accepted into the order book"},"remaining":{"type":"string","description":"The amount remaining for this order."},"trade_id":{"type":"string","format":"uuid","description":"The system generated trade id."},"matched_as":{"type":"string","description":"`MAKER` or `TAKER`","enum":["MAKER","TAKER"]},"matched_amount":{"type":"string","description":"How much of the order was matched with this trade."},"matched_price_avg":{"type":"string","description":"The average price at which the order was filled."},"cum_quote_amount":{"type":"string","description":"The cumulative quote currency amount for the filled portion of the order."},"fee":{"type":"string","description":"The amount taken as fee for this trade"},"fee_currency":{"type":"string","description":"The currency in which the fee was charged. `BUY` orders will be charged fees in the base currency, `SELL` orders will be charged the fee in the quote currency."},"open_volume":{"type":"string","description":"The total volume of contracts currently open for this specific market. If this value is positive, your overall position is `LONG`, if negative, your overall positions is `SHORT`"},"open_position":{"type":"string","description":"The total amount (or notional value in EUR) of this markets contracts you have long/short across all trades."},"margin_used":{"type":"string","description":"The total margin used in your futures account, expressed in quote currency."},"liquidation":{"type":"boolean","description":"Present and `true` if the trade was part of a liquidation event."},"bals":{"type":"array","items":{"$ref":"#/components/schemas/TradingBalance"},"description":"An array containing your account balance (equity) after the order has been booked. In this cash-settled futures account, the array will typically contain a single entry representing your balance in the settlement currency (EUR)."}},"required":["channel_name","type","event","status","order_book_sequence","side","amount","instrument_code","client_id","order_id","time","bals","remaining","trade_id","matched_as","matched_amount","matched_price_avg","cum_quote_amount","fee","fee_currency","open_volume","open_position","margin_used"]},"OrderFullyFilledSpot":{"title":"SpotFilledFully","type":"object","properties":{"channel_name":{"type":"string","const":"TRADING","description":"The name of the WebSocket channel, always `TRADING`."},"type":{"type":"string","const":"DONE","description":"This field is deprecated and will be removed soon, please use the `event` and `status` fields.","deprecated":true},"event":{"type":"string","const":"ORDER","description":"The event type this message relates to."},"status":{"$ref":"#/components/schemas/OrderStatus"},"order_book_sequence":{"type":"integer","format":"int64","description":"The order book sequence number."},"side":{"type":"string","description":"`BUY` or `SELL`","enum":["BUY","SELL"]},"amount":{"type":"string","description":"The amount for the order."},"instrument_code":{"type":"string","description":"The instrument code of the market."},"tif":{"$ref":"#/components/schemas/TimeInForce"},"client_id":{"type":"string","format":"uuid","description":"The client provided, or system generated client id."},"order_id":{"type":"string","format":"uuid","description":"The system generated order id."},"time":{"type":"integer","format":"int64","description":"Nanosecond timestamp the order was accepted into the order book"},"remaining":{"type":"string","description":"The amount remaining for this order. Always `0` for `FILLED_FULLY`."},"price_avg":{"type":"string","description":"The average price at which the order was filled."},"cum_quote_amount":{"type":"string","description":"The cumulative quote currency amount for the filled portion of the order."},"bals":{"type":"array","items":{"$ref":"#/components/schemas/TradingBalance"},"description":"Available balances for the currencies concerned with this market."},"lckd_bals":{"type":"array","items":{"$ref":"#/components/schemas/TradingBalance"},"description":"Locked balances for the currencies concerned with this market."}},"required":["channel_name","type","event","status","order_book_sequence","side","amount","instrument_code","client_id","order_id","time","bals","remaining","price_avg","cum_quote_amount","lckd_bals"]},"OrderFullyFilledFutures":{"title":"FuturesFilledFully","type":"object","properties":{"channel_name":{"type":"string","const":"TRADING","description":"The name of the WebSocket channel, always `TRADING`."},"type":{"type":"string","const":"DONE","description":"This field is deprecated and will be removed soon, please use the `event` and `status` fields.","deprecated":true},"event":{"type":"string","const":"ORDER","description":"The event type this message relates to."},"status":{"$ref":"#/components/schemas/OrderStatus"},"order_book_sequence":{"type":"integer","format":"int64","description":"The order book sequence number."},"side":{"type":"string","description":"`BUY` or `SELL`","enum":["BUY","SELL"]},"amount":{"type":"string","description":"The amount for the order."},"instrument_code":{"type":"string","description":"The instrument code of the market."},"tif":{"$ref":"#/components/schemas/TimeInForce"},"client_id":{"type":"string","format":"uuid","description":"The client provided, or system generated client id."},"order_id":{"type":"string","format":"uuid","description":"The system generated order id."},"time":{"type":"integer","format":"int64","description":"Nanosecond timestamp the order was accepted into the order book"},"remaining":{"type":"string","description":"The amount remaining for this order. Always `0` for `FILLED_FULLY`."},"price_avg":{"type":"string","description":"The average price at which the order was filled."},"cum_quote_amount":{"type":"string","description":"The cumulative quote currency amount for the filled portion of the order."},"margin_used":{"type":"string","description":"The total margin used in your futures account, expressed in quote currency."},"liquidation":{"type":"boolean","description":"Present and `true` if the trade was part of a liquidation event."},"bals":{"type":"array","items":{"$ref":"#/components/schemas/TradingBalance"},"description":"An array containing your account balance (equity) after the order has been booked. In this cash-settled futures account, the array will typically contain a single entry representing your balance in the settlement currency (EUR)."}},"required":["channel_name","type","event","status","order_book_sequence","side","amount","instrument_code","client_id","order_id","time","bals","remaining","price_avg","cum_quote_amount","margin_used"]},"OrderMoved":{"type":"object","title":"MoveOrderSuccessResponse","properties":{"channel_name":{"type":"string","const":"TRADING"},"type":{"type":"string","const":"DONE","description":"This field is deprecated and will be removed soon, please use the `event` and `status` fields.","deprecated":true},"event":{"type":"string","const":"ORDER"},"status":{"type":"string","const":"MOVED"},"instrument_code":{"type":"string","description":"The instrument code of the order that has been moved."},"client_id":{"type":"string","description":"The client_id of the order that has been moved."},"order_id":{"type":"string","description":"The order_id of the order that has been moved."},"order_book_sequence":{"type":"integer","format":"int64","description":"The order book sequence number."},"side":{"type":"string","description":"`BUY` or `SELL`","enum":["BUY","SELL"]},"price":{"type":"string","description":"The new price of the moved order."},"amount":{"type":"string","description":"The amount for the order."},"remaining":{"type":"string","description":"The remaining amount of the order in the order book."},"bals":{"type":"array","items":{"$ref":"#/components/schemas/TradingBalance"},"description":"Available balances for the currencies concerned with this market."},"lckd_bals":{"type":"array","items":{"$ref":"#/components/schemas/TradingBalance"},"description":"Locked balances for the currencies concerned with this market."},"time":{"type":"integer","format":"int64","description":"Nanosecond timestamp the move order was accepted."}},"required":["channel_name","type","event","status","instrument_code","client_id","order_id","order_book_sequence","side","price","amount","remaining","bals","lckd_bals","time"]},"MarginUpdate":{"type":"object","title":"MarginUpdate","properties":{"channel_name":{"type":"string","const":"TRADING","description":"Always set to \"TRADING\" to indicate the trading channel."},"type":{"type":"string","const":"MARGIN_UPDATE","description":"Always set to \"MARGIN_UPDATE\" to identify the message type."},"cash_balance":{"type":"string","description":"The user's current cash balance in their trading account."},"maintenance_margin":{"type":"string","description":"The minimum margin required to maintain the open positions."},"margin_used":{"type":"string","description":"The amount of margin currently in use by open positions."},"estimated_profit":{"type":"string","description":"The unrealised profit or loss from open positions."},"ratio":{"type":"number","description":"The calculated account ratio, determining the account’s margin status."},"status":{"type":"string","description":"The current margin status (ACTIVE, DERISK, or LIQUIDATION).","enum":["ACTIVE","DERISK","LIQUIDATION"]}},"required":["channel_name","type","cash_balance","maintenance_margin","margin_used","estimated_profit","ratio","status"]},"Settlement":{"type":"object","title":"TradingSettlement","properties":{"type":{"type":"string","const":"SETTLEMENT","description":"Always set to `SETTLEMENT` to identify the message type."},"channel_name":{"type":"string","const":"TRADING","description":"Always set to `TRADING` to indicate the trading channel."},"instrument_code":{"type":"string","description":"The unique identifier for the perpetual futures market (e.g., `BTC_EUR_P`)."},"time":{"type":"integer","format":"int64","description":"The timestamp of the settlement, represented in nanoseconds since the Unix epoch."},"direction":{"type":"string","description":"Indicates the direction of the open position, either `LONG` or `SHORT`.","enum":["LONG","SHORT"]},"open_position":{"type":"string"},"open_volume":{"type":"string","description":"The current open contract volume for the position."},"pending_buy_size":{"type":"string","description":"The size of any pending buy orders for the instrument."},"pending_sell_size":{"type":"string","description":"The size of any pending sell orders for the instrument."},"profit":{"type":"string","description":"The profit or loss realised in this specific minutely settlement interval, expressed in the quote currency."},"total_profit":{"type":"string","description":"The cumulative profit or loss realised for the position since it was opened, expressed in the quote currency."},"account_ratio":{"type":"string","description":"The current margin ratio, reflecting the account’s margin health."},"maintenance_margin":{"type":"string","description":"The minimum margin required to maintain the open position."},"quote_currency_balance":{"type":"string","description":"The account's remaining balance in the quote currency after accounting for positions and settlements."},"margin_used":{"type":"string","description":"The total margin currently being used for the open position."},"mark_price":{"type":"string","description":"The current mark price of the instrument used for the minutely settlement calculation."}},"required":["type","channel_name","instrument_code","time","direction","open_position","open_volume","pending_buy_size","pending_sell_size","profit","total_profit","account_ratio","maintenance_margin","quote_currency_balance","margin_used","mark_price"]},"FundingPayment":{"type":"object","title":"FundingPayment","properties":{"type":{"type":"string","const":"FUNDING_PAYMENT","description":"The message type, always \"FUNDING_PAYMENT\" for this event."},"channel_name":{"type":"string","const":"TRADING","description":"The WebSocket channel name, always \"TRADING\"."},"event":{"type":"string","const":"ACCOUNT"},"status":{"type":"string"},"instrument_code":{"type":"string","description":"The trading instrument symbol, e.g., \"BTC_EUR_P\"."},"direction":{"type":"string","description":"The position direction, either \"LONG\" or \"SHORT\".","enum":["LONG","SHORT"]},"open_volume":{"type":"string","description":"The size of the currently open position in the instrument."},"open_position":{"type":"string"},"pending_buy_size":{"type":"string","description":"The size of any pending (unfilled) buy orders for this instrument."},"pending_sell_size":{"type":"string","description":"The size of any pending (unfilled) sell orders for this instrument."},"funding_rate":{"type":"string","description":"The funding rate percentage applied to the position (e.g., \"1\" represents 1%)."},"funding_payment":{"type":"string","description":"The funding payment amount applied to the account. A negative value indicates a deduction, while a positive value indicates a credit."},"cash_balance":{"type":"string","description":"The updated account cash balance after the funding payment is applied."},"maintenance_margin":{"type":"string","description":"The minimum margin required to maintain the open position."},"maintenance_used":{"type":"string","description":"The total maintenance margin currently being used across all positions."},"margin_used":{"type":"string"},"account_ratio":{"type":"number","description":"The account margin ratio."}},"required":["type","channel_name","instrument_code","direction","open_volume","pending_buy_size","pending_sell_size","funding_rate","funding_payment","cash_balance","maintenance_margin","account_ratio"]},"BalanceAdjustment":{"type":"object","title":"BalanceAdjustment","properties":{"channel_name":{"type":"string","const":"TRADING"},"type":{"type":"string","const":"BALANCE_ADJUSTMENT"},"event":{"type":"string","const":"ACCOUNT"},"status":{"type":"string","enum":["DEPOSITED","WITHDRAWN"]},"instrument_code":{"type":"string"},"time":{"type":"integer","format":"int64"},"amount":{"type":"string"},"new_balance":{"type":"string"},"assigned_margin":{"type":"string"}},"required":["channel_name","type","event","status","instrument_code","time","amount","new_balance","assigned_margin"]},"SubscribeAccount":{"type":"object","title":"SubscriptionRequest","properties":{"type":{"type":"string","const":"SUBSCRIBE"},"channels":{"type":"array","minItems":1,"maxItems":1,"items":{"type":"object","properties":{"name":{"type":"string","const":"ACCOUNT","description":"Channel name to subscribe to"}},"required":["name"]}}},"required":["type","channels"]},"AccountSubscribed":{"type":"object","title":"SubscriptionConfirmation","properties":{"type":{"type":"string","const":"SUBSCRIPTIONS"},"channels":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","const":"ACCOUNT","description":"Name of the channel which has just been subscribed to."},"account_id":{"type":"string","description":"The account your token authenticated. Events for every account of the same account holder, main account and subaccounts alike, are sent on the subscription."}},"required":["name"]}},"time":{"type":"integer","format":"int64","description":"Time the message was sent from the server in nanoseconds."}},"required":["type","channels","time"]},"AccountMessageEnvelope":{"type":"object","title":"AccountMessageEnvelope","properties":{"channel_name":{"type":"string","const":"ACCOUNT","description":"`ACCOUNT`."},"type":{"type":"string","const":"EXOTIC_ORDER","description":"The kind of event. The rest of the message depends on it. `EXOTIC_ORDER`: a take profit / stop loss (TP/SL) was created, armed, changed, triggered, executed or cancelled. More types may be added: ignore a `type` you do not recognise."},"time":{"type":"string","description":"When the message was sent, as an ISO 8601 string.","format":"date-time"},"account_id":{"type":"string","description":"The account the event belongs to: your main account, or one of its subaccounts."},"event_timestamp":{"type":"string","description":"When it happened (ISO 8601). Use it to put messages in order.","format":"date-time"}},"required":["channel_name","type","time","account_id","event_timestamp"]},"ExoticOrderRegistered":{"title":"ExoticOrderRegistered","allOf":[{"$ref":"#/components/schemas/AccountMessageEnvelope"},{"type":"object","properties":{"event_type":{"type":"string","const":"EXOTIC_ORDER_REGISTERED","description":"What happened to the TP/SL."},"data":{"type":"object","description":"The TP/SL, in the shape of its `event_type`. Always carries `\"version\": 2`.","properties":{"client_id":{"type":"string","description":"Identifier of the TP/SL. For one attached to an order, that order's `client_id`."},"instrument_code":{"type":"string","description":"The instrument."},"order_kind":{"type":"string","const":"TPSL","description":"`TPSL`."},"tpsl_mode":{"type":"string","description":"`order` or `position`.","enum":["order","position"]},"activation_source":{"type":"string","description":"How a `PENDING` TP/SL arms: `order_fill`, when the order it is attached to fills."},"take_profit_price":{"type":["number","null"],"description":"Take profit level, `null` without one."},"stop_loss_price":{"type":["number","null"],"description":"Stop loss level, `null` without one."},"tp_client_id":{"type":["string","null"],"description":"`client_id` of the close order placed when the take profit fires on a spot market."},"sl_client_id":{"type":["string","null"],"description":"As `tp_client_id`, for the stop loss."},"version":{"type":"integer","const":2,"description":"Version of the message format: `2`. Not the TP/SL's own `version`."},"status":{"type":"string","description":"`PENDING` or `ACTIVE`.","enum":["PENDING","ACTIVE"]}},"required":["client_id","instrument_code","status","version","order_kind","tpsl_mode","activation_source","take_profit_price","stop_loss_price","tp_client_id","sl_client_id"]}},"required":["event_type","data"]}]},"ExoticOrderUpdated":{"title":"ExoticOrderUpdated","allOf":[{"$ref":"#/components/schemas/AccountMessageEnvelope"},{"type":"object","properties":{"event_type":{"type":"string","const":"EXOTIC_ORDER_UPDATED","description":"What happened to the TP/SL."},"data":{"type":"object","description":"The TP/SL, in the shape of its `event_type`. Always carries `\"version\": 2`.","properties":{"client_id":{"type":"string","description":"Identifier of the TP/SL. For one attached to an order, that order's `client_id`."},"instrument_code":{"type":"string","description":"The instrument."},"order_kind":{"type":"string","const":"TPSL","description":"`TPSL`."},"tpsl_mode":{"type":"string","description":"`order` or `position`.","enum":["order","position"]},"activation_source":{"type":"string","description":"How a `PENDING` TP/SL arms: `order_fill`, when the order it is attached to fills."},"take_profit_price":{"type":["number","null"],"description":"Take profit level, `null` without one."},"stop_loss_price":{"type":["number","null"],"description":"Stop loss level, `null` without one."},"tp_client_id":{"type":["string","null"],"description":"`client_id` of the close order placed when the take profit fires on a spot market."},"sl_client_id":{"type":["string","null"],"description":"As `tp_client_id`, for the stop loss."},"version":{"type":"integer","const":2,"description":"Version of the message format: `2`. Not the TP/SL's own `version`."},"status":{"type":"string","description":"`PENDING` or `ACTIVE`.","enum":["PENDING","ACTIVE"]}},"required":["client_id","instrument_code","status","version","order_kind","tpsl_mode","activation_source","take_profit_price","stop_loss_price","tp_client_id","sl_client_id"]}},"required":["event_type","data"]}]},"ExoticOrderActivated":{"title":"ExoticOrderActivated","allOf":[{"$ref":"#/components/schemas/AccountMessageEnvelope"},{"type":"object","properties":{"event_type":{"type":"string","const":"EXOTIC_ORDER_ACTIVATED","description":"What happened to the TP/SL."},"data":{"type":"object","description":"The TP/SL, in the shape of its `event_type`. Always carries `\"version\": 2`.","properties":{"client_id":{"type":"string","description":"Identifier of the TP/SL. For one attached to an order, that order's `client_id`."},"instrument_code":{"type":"string","description":"The instrument."},"order_kind":{"type":"string","const":"TPSL","description":"`TPSL`."},"tpsl_mode":{"type":"string","description":"`order` or `position`.","enum":["order","position"]},"activation_source":{"type":"string","description":"How a `PENDING` TP/SL arms: `order_fill`, when the order it is attached to fills."},"take_profit_price":{"type":["number","null"],"description":"Take profit level, `null` without one."},"stop_loss_price":{"type":["number","null"],"description":"Stop loss level, `null` without one."},"tp_client_id":{"type":["string","null"],"description":"`client_id` of the close order placed when the take profit fires on a spot market."},"sl_client_id":{"type":["string","null"],"description":"As `tp_client_id`, for the stop loss."},"version":{"type":"integer","const":2,"description":"Version of the message format: `2`. Not the TP/SL's own `version`."},"status":{"type":"string","const":"ACTIVE","description":"`ACTIVE`."},"entry_side":{"type":"string","description":"Side of the order or position the TP/SL protects: `BUY` (long) or `SELL` (short).","enum":["BUY","SELL"]},"close_side":{"type":"string","description":"Side of the close order a level will place: the opposite of `entry_side`.","enum":["BUY","SELL"]},"filled_amount":{"type":"number","description":"Order mode: the filled amount of the protected order so far. Position mode: the size of the position when the TP/SL armed."}},"required":["client_id","instrument_code","status","version","order_kind","tpsl_mode","activation_source","take_profit_price","stop_loss_price","tp_client_id","sl_client_id","entry_side","close_side","filled_amount"]}},"required":["event_type","data"]}]},"ExoticOrderTriggered":{"title":"ExoticOrderTriggered","allOf":[{"$ref":"#/components/schemas/AccountMessageEnvelope"},{"type":"object","properties":{"event_type":{"type":"string","const":"EXOTIC_ORDER_TRIGGERED","description":"What happened to the TP/SL."},"message_id":{"type":"string","description":"This message can be delivered more than once with the same `message_id`: deduplicate on it."},"data":{"type":"object","description":"The TP/SL, in the shape of its `event_type`. Always carries `\"version\": 2`.","properties":{"client_id":{"type":"string","description":"Identifier of the TP/SL. For one attached to an order, that order's `client_id`."},"instrument_code":{"type":"string","description":"The instrument."},"status":{"type":"string","const":"TRIGGERED","description":"`TRIGGERED`."},"trigger_source":{"type":"string","description":"The level that was reached: `TP` or `SL`.","enum":["TP","SL"]},"trigger_price":{"type":"number","description":"The level the TP/SL was set with."},"actual_trigger_price":{"type":"number","description":"The price that reached it."},"close_amount":{"type":"string","description":"The amount the close sets out to close."},"close_side":{"type":"string","description":"Side of the close orders: `BUY` or `SELL`.","enum":["BUY","SELL"]},"tp_client_id":{"type":["string","null"],"description":"`client_id` of the close order placed when the take profit fires on a spot market."},"sl_client_id":{"type":["string","null"],"description":"As `tp_client_id`, for the stop loss."},"position_id":{"type":["string","null"],"description":"**Futures.** The position being closed."},"limit_price":{"type":"string","description":"**Futures.** The limit price of every order of the close: the level less the TP/SL's slippage when selling, or plus it when buying. The close never fills at a worse price."},"close_orders":{"type":"array","description":"**Futures.** Every order the close will send, in order. No other order is sent for this close, and their amounts add up to `close_amount`.","items":{"type":"object","properties":{"client_id":{"type":"string","description":"The `client_id` the order is placed under: its order and trade messages carry it."},"amount":{"type":"string","description":"The most the order will send."}},"required":["client_id","amount"]}},"version":{"type":"integer","const":2,"description":"Version of the message format: `2`. Not the TP/SL's own `version`."}},"required":["client_id","instrument_code","status","version","trigger_source","trigger_price","actual_trigger_price","close_amount","close_side","tp_client_id","sl_client_id"]}},"required":["event_type","message_id","data"]}]},"ExoticOrderExecuted":{"title":"ExoticOrderExecuted","allOf":[{"$ref":"#/components/schemas/AccountMessageEnvelope"},{"type":"object","properties":{"event_type":{"type":"string","const":"EXOTIC_ORDER_EXECUTED","description":"What happened to the TP/SL."},"data":{"type":"object","description":"The TP/SL, in the shape of its `event_type`. Always carries `\"version\": 2`.","properties":{"client_id":{"type":"string","description":"Identifier of the TP/SL. For one attached to an order, that order's `client_id`."},"instrument_code":{"type":"string","description":"The instrument."},"status":{"type":"string","const":"COMPLETE","description":"`COMPLETE`."},"trigger_source":{"type":"string","description":"The level that fired: `TP` or `SL`.","enum":["TP","SL"]},"close_amount":{"type":"string","description":"The amount the close set out to close."},"close_side":{"type":"string","description":"Side of the close orders: `BUY` or `SELL`.","enum":["BUY","SELL"]},"tp_client_id":{"type":["string","null"],"description":"`client_id` of the close order placed when the take profit fires on a spot market."},"sl_client_id":{"type":["string","null"],"description":"As `tp_client_id`, for the stop loss."},"closure_status":{"type":"string","description":"**Futures.** `CLOSED`.","enum":["CLOSED"]},"position_id":{"type":["string","null"],"description":"**Futures.** The position that was being closed."},"open_volume":{"type":["string","null"],"description":"**Futures.** What is still open of that position when the close ended, `\"0\"` once it is gone. `null` if it could not be read."},"filled_amount":{"type":"string","description":"**Futures.** The total filled across `close_orders`."},"close_orders":{"type":"array","items":{"type":"object","properties":{"client_id":{"type":"string","description":"The order's `client_id`, as on its order and trade messages."},"amount":{"type":"string","description":"The most the order was planned to send."},"status":{"type":"string","description":"The exchange's final status for the order (e.g. `FILLED_FULLY`), the error code it was refused with, `UNKNOWN` when no outcome arrived in time, or `NOT_SENT` when the close ended before it went out."},"order_id":{"type":["string","null"],"description":"The exchange's `order_id`. `null` for an order that was never placed."},"filled_amount":{"type":"string","description":"What the order filled. Estimated from the change in the position when its status is `UNKNOWN`."}},"required":["client_id","amount","status","order_id","filled_amount"]},"description":"**Futures.** Every order of the close, in the order they were planned."},"version":{"type":"integer","const":2,"description":"Version of the message format: `2`. Not the TP/SL's own `version`."}},"required":["client_id","instrument_code","status","version","trigger_source","close_amount","close_side","tp_client_id","sl_client_id"]}},"required":["event_type","data"]}]},"ExoticOrderCancelled":{"title":"ExoticOrderCancelled","allOf":[{"$ref":"#/components/schemas/AccountMessageEnvelope"},{"type":"object","properties":{"event_type":{"type":"string","const":"EXOTIC_ORDER_CANCELLED","description":"What happened to the TP/SL."},"data":{"type":"object","description":"The TP/SL, in the shape of its `event_type`. Always carries `\"version\": 2`.","properties":{"client_id":{"type":"string","description":"Identifier of the TP/SL. For one attached to an order, that order's `client_id`."},"instrument_code":{"type":"string","description":"The instrument."},"status":{"type":"string","const":"CANCELLED","description":"`CANCELLED`."},"previous_status":{"type":"string","description":"The status it was cancelled from: `PENDING`, `ACTIVE` or `TRIGGERED`.","enum":["PENDING","ACTIVE","TRIGGERED"]},"reason":{"type":"string","description":"Why it was cancelled. New reasons may be added: treat one you do not recognise as a cancellation."},"failed_legs":{"type":"array","items":{"type":"string","enum":["TP","SL"]},"description":"**`VALIDATION_FAILED_AT_ACTIVATION` only.** The levels that had already been reached: `TP`, `SL` or both."},"reference_mid":{"type":"number","description":"**`VALIDATION_FAILED_AT_ACTIVATION` only.** The price they were checked against."},"closure_status":{"type":"string","description":"**Futures close that stopped only.** `PARTIALLY_CLOSED` when anything filled, `FAILED` when nothing did.","enum":["PARTIALLY_CLOSED","FAILED"]},"position_id":{"type":["string","null"],"description":"**Futures close that stopped only.** The position that was being closed."},"open_volume":{"type":["string","null"],"description":"**Futures close that stopped only.** What is still open of that position when the close ended, `\"0\"` once it is gone. `null` if it could not be read."},"filled_amount":{"type":"string","description":"**Futures close that stopped only.** The total filled across `close_orders`."},"close_orders":{"type":"array","items":{"type":"object","properties":{"client_id":{"type":"string","description":"The order's `client_id`, as on its order and trade messages."},"amount":{"type":"string","description":"The most the order was planned to send."},"status":{"type":"string","description":"The exchange's final status for the order (e.g. `FILLED_FULLY`), the error code it was refused with, `UNKNOWN` when no outcome arrived in time, or `NOT_SENT` when the close ended before it went out."},"order_id":{"type":["string","null"],"description":"The exchange's `order_id`. `null` for an order that was never placed."},"filled_amount":{"type":"string","description":"What the order filled. Estimated from the change in the position when its status is `UNKNOWN`."}},"required":["client_id","amount","status","order_id","filled_amount"]},"description":"**Futures close that stopped only.** Every order of the close, in the order they were planned."},"version":{"type":"integer","const":2,"description":"Version of the message format: `2`. Not the TP/SL's own `version`."}},"required":["client_id","instrument_code","status","version","previous_status","reason"]}},"required":["event_type","data"]}]}},"messages":{"authenticate":{"name":"authenticate","title":"Authenticate","summary":"Client authenticates the connection with an API token.","description":"Send before subscribing to any private channel (`TRADING`, `ACCOUNT`). If the token is valid it authorises subscriptions and requests for all private channels on this connection. The token must have the `Trade` permission.","contentType":"application/json","payload":{"$ref":"#/components/schemas/Authenticate"},"examples":[{"name":"authenticate","summary":"Authentication request","payload":{"type":"AUTHENTICATE","api_token":"eyJ..."}}]},"authenticated":{"name":"authenticated","title":"Authenticated","summary":"The API token was accepted.","contentType":"application/json","payload":{"$ref":"#/components/schemas/Authenticated"},"examples":[{"name":"authenticated","summary":"Authentication succeeded","payload":{"type":"AUTHENTICATED"}}]},"authenticationFailed":{"name":"authenticationFailed","title":"Authentication Failed","summary":"The API token was rejected.","description":"| `error` | Meaning |\n|---|---|\n| `AUTH_ERROR` | The token is missing, invalid or was not accepted. |\n| `ACCOUNT_RESTRICTED` | The account the token belongs to is restricted. |\n\nStraight after sending the error, the server closes the connection with close code `3000`. Open a new connection to try again.","contentType":"application/json","payload":{"$ref":"#/components/schemas/AuthenticationFailed"},"examples":[{"name":"authError","summary":"Token rejected","payload":{"error":"AUTH_ERROR"}},{"name":"accountRestricted","summary":"Account restricted","payload":{"error":"ACCOUNT_RESTRICTED"}}]},"subscribe":{"name":"subscribe","title":"Subscribe","summary":"Client subscribes to one channel.","description":"You can only subscribe to **one** channel in a single `SUBSCRIBE` message. `ORDER_BOOK`, `PRICE_TICKS` and `BOOK_TICKER` require an `instrument_codes` property alongside the channel name; `MARK_PRICE` takes it optionally. A further `SUBSCRIBE` to the same channel adds instruments rather than replacing them, except on `MARK_PRICE`. See each channel for its exact subscribe message.","contentType":"application/json","payload":{"$ref":"#/components/schemas/Subscribe"},"examples":[{"name":"subscribeTrading","summary":"Subscribe to the TRADING channel","payload":{"type":"SUBSCRIBE","channels":[{"name":"TRADING"}]}}]},"subscriptions":{"name":"subscriptions","title":"Subscriptions","summary":"Server confirms the subscription.","contentType":"application/json","payload":{"$ref":"#/components/schemas/Subscriptions"},"examples":[{"name":"tradingSubscribed","summary":"Subscribed to the TRADING channel","payload":{"type":"SUBSCRIPTIONS","channels":[{"name":"TRADING","account_id":"726288e6-a463-4f88-9068-024ae8f97a34"}],"time":1731671164898119400}}]},"subscriptionError":{"name":"subscriptionError","title":"Subscription Error","summary":"Server rejects a SUBSCRIBE request.","description":"| `error` | Meaning |\n|---|---|\n| `INVALID_CHANNEL` | The channel name is unknown. Also sent for `ORDER_BOOK` and `PRICE_TICKS` when `instrument_codes` is left out. |\n| `INVALID_MESSAGE_FORMAT` | `channels` is missing, or names more than one channel. The connection stays open. |\n| `AUTHENTICATION_REQUIRED` | The channel is private (`TRADING`, `ACCOUNT`) and the connection has not authenticated. |\n| `INVALID_INSTRUMENT_CODES_LIST` | `instrument_codes` is empty, or, on `BOOK_TICKER`, missing. Carries `channel_name`. |\n| `INVALID_INSTRUMENT_CODES` | One or more instrument codes were not recognised. Carries `channel_name`, and the codes in `invalid_instruments`. |\n\nA rejected request changes nothing: any subscriptions you already have stay in place. `MARK_PRICE` reports instrument code errors with Mark Price Error.","contentType":"application/json","payload":{"$ref":"#/components/schemas/SubscriptionError"},"examples":[{"name":"invalidChannel","summary":"Unknown channel name","payload":{"error":"INVALID_CHANNEL"}},{"name":"authenticationRequired","summary":"Private channel before AUTHENTICATE","payload":{"error":"AUTHENTICATION_REQUIRED"}},{"name":"invalidInstrumentCodesList","summary":"Empty instrument code list","payload":{"channel_name":"BOOK_TICKER","error":"INVALID_INSTRUMENT_CODES_LIST"}},{"name":"invalidInstrumentCodes","summary":"Unknown instrument code","payload":{"channel_name":"ORDER_BOOK","error":"INVALID_INSTRUMENT_CODES","invalid_instruments":["BTC_PEPE"]}}]},"unsubscribe":{"name":"unsubscribe","title":"Unsubscribe","summary":"Client unsubscribes from one or more channels.","description":"`channels` lists plain channel names, not the objects `SUBSCRIBE` takes. Unsubscribing from a market data channel drops all of its instruments; to keep some, subscribe to them again afterwards.","contentType":"application/json","payload":{"$ref":"#/components/schemas/Unsubscribe"},"examples":[{"name":"orderBookAndPriceTicks","summary":"Unsubscribe from ORDER_BOOK and PRICE_TICKS","payload":{"type":"UNSUBSCRIBE","channels":["ORDER_BOOK","PRICE_TICKS"]}}]},"unsubscribed":{"name":"unsubscribed","title":"Unsubscribed","summary":"Server confirms that one channel has been left.","description":"One is sent for each channel named in the `UNSUBSCRIBE` request.","contentType":"application/json","payload":{"$ref":"#/components/schemas/Unsubscribed"},"examples":[{"name":"orderBookUnsubscribed","summary":"Left the ORDER_BOOK channel","payload":{"type":"UNSUBSCRIBED","channel_name":"ORDER_BOOK"}}]},"unsubscribeError":{"name":"unsubscribeError","title":"Unsubscribe Error","summary":"Server could not unsubscribe one channel.","description":"Sent in place of `UNSUBSCRIBED` for a channel the server could not unsubscribe, such as an unknown channel name. The other channels in the request are still processed.","contentType":"application/json","payload":{"$ref":"#/components/schemas/UnsubscribeError"},"examples":[{"name":"unknownChannel","summary":"Unknown channel name","payload":{"type":"UNSUBSCRIBE_ERROR","channel_name":"ORDERBOOK"}}]},"heartbeat":{"name":"heartbeat","title":"Heartbeat","summary":"Heartbeat sent by the server every 10 seconds.","description":"Sent to every connection every 10 seconds, from the moment it opens. No reply is expected. The connection has an idle timeout of 300 seconds, so a recommended keep-alive strategy is to send a native WebSocket ping each time a heartbeat arrives. If no pong arrives, close the socket and reconnect.","contentType":"application/json","payload":{"$ref":"#/components/schemas/Heartbeat"},"examples":[{"name":"heartbeat","summary":"Heartbeat","payload":{"channel_name":"SYSTEM","subscription":"SYSTEM","time":1738602951685556000,"type":"HEARTBEAT"}}]},"subscribeOrderBook":{"name":"subscribeOrderBook","title":"Subscribe to Order Book","summary":"Client subscribes to the ORDER_BOOK channel.","contentType":"application/json","payload":{"$ref":"#/components/schemas/SubscribeOrderBook"},"examples":[{"name":"orderBookBtcEth","summary":"Subscribe to BTC_EUR and ETH_EUR order books","payload":{"type":"SUBSCRIBE","channels":[{"name":"ORDER_BOOK","instrument_codes":["BTC_EUR","ETH_EUR"]}]}}]},"orderBookSubscribed":{"name":"orderBookSubscribed","title":"Order Book Subscribed","summary":"Server confirms the ORDER_BOOK subscription.","contentType":"application/json","payload":{"$ref":"#/components/schemas/OrderBookSubscribed"},"examples":[{"name":"orderBookSubscribed","summary":"Subscribed to BTC_EUR and ETH_EUR","payload":{"type":"SUBSCRIPTIONS","channels":[{"name":"ORDER_BOOK","instrument_codes":["BTC_EUR","ETH_EUR"]}],"time":1732050545807000000}}]},"orderBookSnapshot":{"name":"orderBookSnapshot","title":"Order Book Snapshot","summary":"Full order book for one instrument, sent on subscription.","description":"Provides an immediate overview of all the bids and asks in a particular market at the time of subscription. Each level in `asks` and `bids` is `[PRICE, AMOUNT]`. It is always the first order book message you receive for the instrument: updates are held back until it has been sent, and any update it already includes is left out. Keep its `unum_bids` and `unum_asks`, and apply the updates that follow on from them. You will only receive updates for the `instrument_codes` you specified.","contentType":"application/json","payload":{"$ref":"#/components/schemas/OrderBookSnapshot"},"examples":[{"name":"btcEurSnapshot","summary":"BTC_EUR snapshot","payload":{"channel_name":"ORDER_BOOK","type":"ORDER_BOOK_SNAPSHOT","time":1715268699262970600,"instrument_code":"BTC_EUR","bids":[["10000","6"]],"asks":[["100000","4"]],"unum_bids":48213,"unum_asks":48213}}]},"orderBookUpdate":{"name":"orderBookUpdate","title":"Order Book Update","summary":"Incremental change to the order book for one instrument.","description":"Each entry in `changes` is `[SIDE, PRICE, AMOUNT]`. If the amount value is `0`, the price level has been removed from the order book.\n\nEach update raises `unum_bids` and `unum_asks` by exactly 1. Apply an update only when both are 1 more than the values you last held, from the snapshot or the previous update. If they jump further, an update was missed: discard your copy of the book and send `SUBSCRIBE` for the instrument again, which sends a fresh snapshot.","contentType":"application/json","payload":{"$ref":"#/components/schemas/OrderBookUpdate"},"examples":[{"name":"btcEurUpdate","summary":"BTC_EUR bid level change","payload":{"type":"ORDER_BOOK_UPDATE","channel_name":"ORDER_BOOK","time":1715268699262970600,"instrument_code":"BTC_EUR","changes":[["BUY","6500.09","0.84702376"]],"unum_bids":48214,"unum_asks":48214}}]},"subscribePriceTicks":{"name":"subscribePriceTicks","title":"Subscribe to Price Ticks","summary":"Client subscribes to the PRICE_TICKS channel.","contentType":"application/json","payload":{"$ref":"#/components/schemas/SubscribePriceTicks"},"examples":[{"name":"priceTicksBtcEth","summary":"Subscribe to BTC_EUR and ETH_EUR price ticks","payload":{"type":"SUBSCRIBE","channels":[{"name":"PRICE_TICKS","instrument_codes":["BTC_EUR","ETH_EUR"]}]}}]},"priceTicksSubscribed":{"name":"priceTicksSubscribed","title":"Price Ticks Subscribed","summary":"Server confirms the PRICE_TICKS subscription.","contentType":"application/json","payload":{"$ref":"#/components/schemas/PriceTicksSubscribed"},"examples":[{"name":"priceTicksSubscribed","summary":"Subscribed to BTC_EUR and ETH_EUR","payload":{"type":"SUBSCRIPTIONS","channels":[{"name":"PRICE_TICKS","instrument_codes":["BTC_EUR","ETH_EUR"]}],"time":1732051274299000000}}]},"priceTick":{"name":"priceTick","title":"Price Tick","summary":"A trade was executed on a subscribed instrument.","contentType":"application/json","payload":{"$ref":"#/components/schemas/PriceTick"},"examples":[{"name":"btcEurTick","summary":"BTC_EUR trade","payload":{"channel_name":"PRICE_TICKS","type":"PRICE_TICK","time":1732051723847246300,"instrument_code":"BTC_EUR","price":"100000","amount":"0.001","volume":"100","best_bid":"10000","best_ask":"100000","taker_side":"BUY"}}]},"priceTickHistory":{"name":"priceTickHistory","title":"Price Tick History","summary":"The most recent price ticks for one instrument, sent on subscription.","description":"Sent once per instrument when you subscribe, before any `PRICE_TICK`. `history` holds up to the 80 most recent ticks, oldest first, in the same fields as `PRICE_TICK` without `channel_name` and `type`. It is empty when no history is available.","contentType":"application/json","payload":{"$ref":"#/components/schemas/PriceTickHistory"},"examples":[{"name":"btcEurHistory","summary":"BTC_EUR history (two ticks shown)","payload":{"channel_name":"PRICE_TICKS","type":"PRICE_TICK_HISTORY","time":1732051723912000000,"instrument_code":"BTC_EUR","history":[{"time":1732051690118422500,"instrument_code":"BTC_EUR","price":"99950","amount":"0.002","volume":"199.9","best_bid":"99900","best_ask":"100000","taker_side":"SELL"},{"time":1732051723847246300,"instrument_code":"BTC_EUR","price":"100000","amount":"0.001","volume":"100","best_bid":"99950","best_ask":"100000","taker_side":"BUY"}]}}]},"subscribeBookTicker":{"name":"subscribeBookTicker","title":"Subscribe to Book Ticker","summary":"Client subscribes to the BOOK_TICKER channel.","description":"`instrument_codes` is required: a missing or empty list is rejected with `INVALID_INSTRUMENT_CODES_LIST`.","contentType":"application/json","payload":{"$ref":"#/components/schemas/SubscribeBookTicker"},"examples":[{"name":"bookTickerBtcEth","summary":"Subscribe to BTC_EUR and ETH_EUR top of book","payload":{"type":"SUBSCRIBE","channels":[{"name":"BOOK_TICKER","instrument_codes":["BTC_EUR","ETH_EUR"]}]}}]},"bookTickerSubscribed":{"name":"bookTickerSubscribed","title":"Book Ticker Subscribed","summary":"Server confirms the BOOK_TICKER subscription.","contentType":"application/json","payload":{"$ref":"#/components/schemas/BookTickerSubscribed"},"examples":[{"name":"bookTickerSubscribed","summary":"Subscribed to BTC_EUR and ETH_EUR","payload":{"type":"SUBSCRIPTIONS","channels":[{"name":"BOOK_TICKER","instrument_codes":["BTC_EUR","ETH_EUR"]}],"time":1732051274299000000}}]},"bookTickerSnapshot":{"name":"bookTickerSnapshot","title":"Book Ticker Snapshot","summary":"Current best bid and ask for one instrument, sent on subscription.","description":"Sent once per instrument when you subscribe, before any `BOOK_TICK`, with the same `data` as `BOOK_TICK`. It is not sent for an instrument that has no order book, such as a closed market. A side of the book with no orders is shown as `\"0\"`.","contentType":"application/json","payload":{"$ref":"#/components/schemas/BookTickerSnapshot"},"examples":[{"name":"btcEurBookTickerSnapshot","summary":"BTC_EUR top of book on subscription","payload":{"channel_name":"BOOK_TICKER","type":"BOOK_TICKER_SNAPSHOT","time":1732056122401000000,"instrument_code":"BTC_EUR","data":{"best_bid":"57500","bid_amount":"0.1","best_ask":"58000","ask_amount":"0.1"}}}]},"bookTick":{"name":"bookTick","title":"Book Tick","summary":"Best bid and ask, with their amounts, for one instrument.","contentType":"application/json","payload":{"$ref":"#/components/schemas/BookTick"},"examples":[{"name":"btcEurBookTick","summary":"BTC_EUR top of book","payload":{"channel_name":"BOOK_TICKER","type":"BOOK_TICK","time":1732056122430542800,"instrument_code":"BTC_EUR","data":{"best_bid":"57500","bid_amount":"0.1","best_ask":"58000","ask_amount":"0.1"}}}]},"subscribeMarkPrice":{"name":"subscribeMarkPrice","title":"Subscribe to Mark Price","summary":"Client subscribes to the MARK_PRICE channel.","description":"A connection has one `MARK_PRICE` selection: every instrument, or a list. A new `SUBSCRIBE` replaces it, so you never receive a mark twice.","contentType":"application/json","payload":{"$ref":"#/components/schemas/SubscribeMarkPrice"},"examples":[{"name":"allInstruments","summary":"Every futures instrument","payload":{"type":"SUBSCRIBE","channels":[{"name":"MARK_PRICE"}]}},{"name":"selectedInstruments","summary":"Selected instruments","payload":{"type":"SUBSCRIBE","channels":[{"name":"MARK_PRICE","instrument_codes":["BTC_USD_P","ETH_USD_P"]}]}}]},"markPriceSubscribed":{"name":"markPriceSubscribed","title":"Mark Price Subscribed","summary":"Server confirms the MARK_PRICE subscription.","contentType":"application/json","payload":{"$ref":"#/components/schemas/MarkPriceSubscribed"},"examples":[{"name":"markPriceSubscribed","summary":"Subscribed to BTC_USD_P and ETH_USD_P","payload":{"type":"SUBSCRIPTIONS","channels":[{"name":"MARK_PRICE","instrument_codes":["BTC_USD_P","ETH_USD_P"]}],"time":1762700000299000000}}]},"updateMarkPriceSubscription":{"name":"updateMarkPriceSubscription","title":"Update Mark Price Subscription","summary":"Client replaces its MARK_PRICE instrument selection.","description":"Replaces the connection's `MARK_PRICE` selection, like a new `SUBSCRIBE`, and answers with `SUBSCRIPTION_UPDATED`. A request that is rejected leaves the previous selection in place.","contentType":"application/json","payload":{"$ref":"#/components/schemas/UpdateMarkPriceSubscription"},"examples":[{"name":"switchToSol","summary":"Switch the selection to SOL_USD_P","payload":{"type":"UPDATE_SUBSCRIPTION","channels":[{"name":"MARK_PRICE","instrument_codes":["SOL_USD_P"]}]}}]},"markPriceSubscriptionUpdated":{"name":"markPriceSubscriptionUpdated","title":"Subscription Updated","summary":"Server confirms the new MARK_PRICE selection.","contentType":"application/json","payload":{"$ref":"#/components/schemas/MarkPriceSubscriptionUpdated"},"examples":[{"name":"updated","summary":"Selection updated","payload":{"type":"SUBSCRIPTION_UPDATED","channel_name":"MARK_PRICE"}}]},"markPriceError":{"name":"markPriceError","title":"Mark Price Error","summary":"Server rejects a MARK_PRICE subscribe or update request.","description":"| `error` | Meaning |\n|---|---|\n| `INVALID_INSTRUMENT_CODES_LIST` | `instrument_codes` was sent as an empty list. Leave the field out to receive every instrument. |\n| `INVALID_INSTRUMENT_CODES` | One or more instrument codes are unknown, or are spot instruments. They are listed in `invalid_instruments`. |\n\nA request that is rejected leaves the previous selection in place.","contentType":"application/json","payload":{"$ref":"#/components/schemas/MarkPriceError"},"examples":[{"name":"invalidCodes","summary":"Spot instrument code rejected","payload":{"channel_name":"MARK_PRICE","error":"INVALID_INSTRUMENT_CODES","invalid_instruments":["BTC_USDT"]}}]},"markPriceUpdate":{"name":"markPriceUpdate","title":"Mark Price Update","summary":"Mark price of one futures instrument, every 5 seconds.","description":"One is sent per instrument straight after you subscribe, then every 5 seconds, on the clock (:00, :05, :10, …). An instrument whose mark price is missing, or more than 10 seconds old, gets no message until a current one is available.","contentType":"application/json","payload":{"$ref":"#/components/schemas/MarkPriceUpdate"},"examples":[{"name":"btcUsdPerp","summary":"BTC_USD_P mark price","payload":{"channel_name":"MARK_PRICE","time":1762700000123456800,"type":"MARK_PRICE_UPDATE","instrument_code":"BTC_USD_P","data":{"time":1762700000000000000,"mark_price":"101234.5","index_price":"101230.1","tier":"ANCHORED","session":true}}}]},"subscribeTrading":{"name":"subscribeTrading","title":"Subscribe to Trading","summary":"Client subscribes to the TRADING channel.","description":"Requires a prior successful `AUTHENTICATE` with a token that has the `Trade` permission.","contentType":"application/json","payload":{"$ref":"#/components/schemas/SubscribeTrading"},"examples":[{"name":"trading","summary":"Subscribe to the TRADING channel","payload":{"type":"SUBSCRIBE","channels":[{"name":"TRADING"}]}}]},"tradingSubscribed":{"name":"tradingSubscribed","title":"Trading Subscribed","summary":"Server confirms the TRADING subscription.","contentType":"application/json","payload":{"$ref":"#/components/schemas/TradingSubscribed"},"examples":[{"name":"tradingSubscribed","summary":"Subscribed to the TRADING channel","payload":{"type":"SUBSCRIPTIONS","channels":[{"name":"TRADING","account_id":"726288e6-a463-4f88-9068-024ae8f97a34"}],"time":1732051274299000000}}]},"createOrder":{"name":"createOrder","title":"Create Order","summary":"Client places a new order.","contentType":"application/json","payload":{"$ref":"#/components/schemas/CreateOrder"},"examples":[{"name":"limitSell","summary":"Limit sell, good till cancelled","payload":{"type":"CREATE_ORDER","order":{"instrument_code":"BTC_EUR","amount":"0.1","side":"SELL","type":"LIMIT","price":"85000","time_in_force":"GOOD_TILL_CANCELLED"}}},{"name":"limitBuyWithReservePrice","summary":"Limit buy with a reserve price for later moves","payload":{"type":"CREATE_ORDER","order":{"instrument_code":"BTC_EUR","type":"LIMIT","side":"BUY","amount":"0.01","price":"85000","time_in_force":"GOOD_TILL_CANCELLED","reserve_price":"90000"}}}]},"moveOrder":{"name":"moveOrder","title":"Move Order","summary":"Client changes the price of an open limit order.","description":"Identify the order by `order_id` or `client_id`. Only the price can be adjusted, not the amount.","contentType":"application/json","payload":{"$ref":"#/components/schemas/MoveOrder"},"examples":[{"name":"byOrderId","summary":"Move by order ID","payload":{"type":"MOVE_ORDER","order":{"order_id":"ac233037-7483-409e-942f-8f4bb38f373c","instrument_code":"BTC_EUR","price":"85100"}}},{"name":"byClientId","summary":"Move by client ID","payload":{"type":"MOVE_ORDER","order":{"client_id":"1daf8283-48c4-437b-90d7-7510bda55643","instrument_code":"BTC_EUR","price":"85100"}}}]},"cancelOrderByClientId":{"name":"cancelOrderByClientId","title":"Cancel Order by Client ID","summary":"Client cancels an open order by its client_id.","description":"If you have created multiple orders with the same `client_id`, only the most recent will be cancelled with this request. It is your responsibility to ensure uniqueness in your client_ids.","contentType":"application/json","payload":{"$ref":"#/components/schemas/CancelOrderByClientId"},"examples":[{"name":"byClientId","summary":"Cancel by client ID","payload":{"type":"CANCEL_ORDER","client_id":"8fd80590-4679-4e7d-9ef9-4346dadb5c8f"}}]},"cancelOrderByOrderId":{"name":"cancelOrderByOrderId","title":"Cancel Order by Order ID","summary":"Client cancels an open order by its order_id.","contentType":"application/json","payload":{"$ref":"#/components/schemas/CancelOrderByOrderId"},"examples":[{"name":"byOrderId","summary":"Cancel by order ID","payload":{"type":"CANCEL_ORDER","order_id":"cf39efef-2924-4713-9fb0-e06bd4acd13d"}},{"name":"byOrderIdWithInstrument","summary":"Cancel by order ID, naming the instrument","payload":{"type":"CANCEL_ORDER","order_id":"cf39efef-2924-4713-9fb0-e06bd4acd13d","instrument_code":"BTC_EUR"}}]},"cancelAllOrders":{"name":"cancelAllOrders","title":"Cancel All Orders","summary":"Client cancels all open orders, optionally for one instrument.","description":"Passing an `instrument_code` results in even faster cancellations.","contentType":"application/json","payload":{"$ref":"#/components/schemas/CancelAllOrders"},"examples":[{"name":"btcEurOnly","summary":"Cancel all BTC_EUR orders","payload":{"type":"CANCEL_ALL_ORDERS","instrument_code":"BTC_EUR"}}]},"orderError":{"name":"orderError","title":"Order Request Error","summary":"Server rejects a trading request.","description":"Returned for `CREATE_ORDER`, `MOVE_ORDER`, `CANCEL_ORDER` and `CANCEL_ALL_ORDERS` requests that fail initial validation, or that are refused before they reach the exchange. The rest of the message depends on the request:\n\n- **`CREATE_ORDER`:** `payload` echoes the request.\n- **`MOVE_ORDER` and `CANCEL_ORDER`:** an error from the exchange carries the `order_id` or `client_id` you sent instead of `payload`. `CLIENT_ID_ERROR` and `ORDER_ID_ERROR` for an identifier that is not a UUID echo the request in `payload`.\n- **`CANCEL_ALL_ORDERS`:** the exchange's error is passed on exactly as it sends it, without echoing the request.\n\nThese errors can be returned for any order request, before it reaches the exchange:\n\n| `error` | Meaning |\n|---|---|\n| `AUTHENTICATION_REQUIRED` | The connection has not authenticated (`CREATE_ORDER`, `MOVE_ORDER`, `CANCEL_ORDER`). |\n| `NOT_AUTHENTICATED` | The connection has not authenticated (`CANCEL_ALL_ORDERS`). |\n| `NOT_SUBSCRIBED_TO_TRADING_CHANNEL` | The connection has not subscribed to `TRADING`. |\n| `RATE_LIMITED` | The account's order rate limit has been reached. Carries `message` and `details`; the request was not sent. |\n| `INTERNAL_ERROR` | The request could not be passed to the exchange. `payload` echoes it. Check the `TRADING` channel or the REST API before retrying, in case it did reach the exchange. |","contentType":"application/json","payload":{"$ref":"#/components/schemas/OrderError"},"examples":[{"name":"minNotional","summary":"Create order below the minimum notional","payload":{"error":"MIN_NOTIONAL_ERROR","payload":{"type":"CREATE_ORDER","order":{"instrument_code":"BTC_EUR","type":"LIMIT","side":"BUY","amount":"0.00001","price":"80000","time_in_force":"GTC","reserve_price":"100000"}}}},{"name":"minPriceExceeded","summary":"Move order below the minimum price","payload":{"error":"MIN_PRICE_EXCEEDED_ERROR","order_id":"a9ed7098-4f53-455a-9dc9-70444e8950a1"}},{"name":"invalidClientId","summary":"Cancel with an invalid client ID","payload":{"error":"CLIENT_ID_ERROR","payload":{"type":"CANCEL_ORDER","client_id":"not valid"}}},{"name":"invalidOrderId","summary":"Cancel with an invalid order ID","payload":{"error":"ORDER_ID_ERROR","payload":{"type":"CANCEL_ORDER","order_id":"not valid"}}},{"name":"unknownPair","summary":"Cancel all on an unknown instrument","payload":{"error":"PAIR_ERROR"}},{"name":"notSubscribed","summary":"Order request without a TRADING subscription","payload":{"error":"NOT_SUBSCRIBED_TO_TRADING_CHANNEL"}},{"name":"rateLimited","summary":"Order rate limit reached (retail account)","payload":{"error":"RATE_LIMITED","message":"TOO_MANY_REQUESTS","details":"Current limit is 600 per minute"}},{"name":"internalError","summary":"Create order could not be passed to the exchange","payload":{"error":"INTERNAL_ERROR","payload":{"type":"CREATE_ORDER","order":{"instrument_code":"BTC_EUR","type":"LIMIT","side":"BUY","amount":"0.01","price":"85000","time_in_force":"GOOD_TILL_CANCELLED"}}}}]},"orderNotFound":{"name":"orderNotFound","title":"Order Not Found","summary":"Server cannot find the order a CANCEL_ORDER request refers to.","contentType":"application/json","payload":{"$ref":"#/components/schemas/OrderNotFound"},"examples":[{"name":"byClientId","summary":"Cancel by client ID: not found","payload":{"error":"ORDER_NOT_FOUND","client_id":"8fd80590-4679-4e7d-9ef9-4346dadb5c8f"}},{"name":"byOrderId","summary":"Cancel by order ID: not found","payload":{"error":"ORDER_NOT_FOUND","order_id":"cf39efef-2924-4713-9fb0-e06bd4acd13d"}}],"x-docs-gap":"No data schema or field descriptions for the ORDER_NOT_FOUND response. It is set by the exchange and passed through unchanged by the WebSocket server, so its shape cannot be confirmed from that server's code."},"noOrdersToCancel":{"name":"noOrdersToCancel","title":"No Orders to Cancel","summary":"CANCEL_ALL_ORDERS found no open orders.","contentType":"application/json","payload":{"$ref":"#/components/schemas/NoOrdersToCancel"},"examples":[{"name":"noOrders","summary":"Nothing to cancel","payload":{"error":"no orders to cancel"}}],"x-docs-gap":"No data schema for this response; the error is a lowercase free-text string rather than a code. The response is set by the exchange and passed through unchanged by the WebSocket server, so its wording cannot be confirmed from that server's code."},"cancellationsBooked":{"name":"cancellationsBooked","title":"Cancellations Booked","summary":"CANCEL_ALL_ORDERS was accepted; one Order Closed follows per order.","contentType":"application/json","payload":{"$ref":"#/components/schemas/CancellationsBooked"},"examples":[{"name":"twoOrders","summary":"Two orders being cancelled","payload":{"channel_name":"TRADING","type":"BOOKED","details":"cancelling 2 orders"}}],"x-docs-gap":"No data schema or field descriptions for the cancel-all BOOKED notification. It is set by the exchange and passed through unchanged by the WebSocket server, so its shape cannot be confirmed from that server's code."},"orderBookedSpot":{"name":"orderBookedSpot","title":"Order Booked (Spot)","summary":"A spot order was accepted into the order book. The `type` field (`BOOKED`/`DONE`/`FILL`) is deprecated: use `event` and `status`.","contentType":"application/json","payload":{"$ref":"#/components/schemas/OrderBookedSpot"},"examples":[{"name":"spotBooked","summary":"Spot limit sell booked","payload":{"channel_name":"TRADING","type":"BOOKED","event":"ORDER","status":"OPEN","order_book_sequence":70422217646,"side":"SELL","amount":"0.1","price":"85000","instrument_code":"BTC_EUR","tif":"GTC","client_id":"c95d3780-cd25-44e2-a7c6-5f04991e819e","order_id":"b3572bca-4c88-4fc0-8537-2ada40cd91c1","time":1743072083415515100,"bals":[{"c":"BTC","a":"10"},{"c":"EUR","a":"20000"}],"lckd_bals":[{"c":"BTC","a":"0.1"},{"c":"EUR","a":"0"}]}}]},"orderBookedFutures":{"name":"orderBookedFutures","title":"Order Booked (Futures)","summary":"A futures order was accepted into the order book. The `type` field (`BOOKED`/`DONE`/`FILL`) is deprecated: use `event` and `status`.","contentType":"application/json","payload":{"$ref":"#/components/schemas/OrderBookedFutures"},"examples":[{"name":"futuresBooked","summary":"Futures limit buy booked","payload":{"channel_name":"TRADING","type":"BOOKED","event":"ORDER","status":"OPEN","order_book_sequence":70422328145,"side":"BUY","uid":1407374883553397,"amount":"0.5","price":"95000","instrument_code":"BTC_EUR_P","tif":"GTC","client_id":"e303aa78-ef05-4d25-86df-f30c89411441","order_id":"688c96fd-1b01-4ae1-a43d-fb29551b2546","time":1743073597225086200,"margin_used":"4750","liquidation":true,"bals":[{"c":"EUR","a":"800146.32750407"}]}}],"x-docs-gap":"The futures example includes a `uid` field that is not in data schema 411669 and has no description. The field is set by the exchange and passed through unchanged by the WebSocket server, so its meaning cannot be confirmed from that server's code."},"orderRejectedSpot":{"name":"orderRejectedSpot","title":"Order Rejected (Spot)","summary":"A spot order passed validation but was then rejected. The `type` field (`BOOKED`/`DONE`/`FILL`) is deprecated: use `event` and `status`.","contentType":"application/json","payload":{"$ref":"#/components/schemas/OrderRejectedSpot"},"examples":[{"name":"insufficientFunds","summary":"Spot sell rejected: insufficient funds","payload":{"channel_name":"TRADING","type":"DONE","event":"ORDER","status":"INSUFFICIENT_FUNDS","instrument_code":"BTC_EUR","client_id":"51453434-a081-49d3-a47b-db51d7e705ce","order_id":"f4030a53-7c16-4a64-ad7c-7b9e85bb6412","time":1743072200276955100,"side":"SELL","order_book_sequence":70422226207,"remaining":"0","amount":"2.5","price":"85000","tif":"GTC","bals":[{"c":"BTC","a":"1.5"},{"c":"EUR","a":"100000"}],"lckd_bals":[{"c":"BTC","a":"0"},{"c":"EUR","a":"0"}]}}]},"orderRejectedFutures":{"name":"orderRejectedFutures","title":"Order Rejected (Futures)","summary":"A futures order passed validation but was then rejected. The `type` field (`BOOKED`/`DONE`/`FILL`) is deprecated: use `event` and `status`.","contentType":"application/json","payload":{"$ref":"#/components/schemas/OrderRejectedFutures"},"examples":[{"name":"overMaxPosition","summary":"Futures buy rejected: over max position","payload":{"channel_name":"TRADING","type":"DONE","event":"ORDER","status":"RISK_FAILED_OVER_MAX_POSITION","instrument_code":"BTC_EUR_P","client_id":"b2cc4a47-aa4e-40a7-a2ff-e229b117d4df","order_id":"be5b6780-cb1d-459d-81fd-e2248a66bf23","time":1743073689388694800,"side":"BUY","order_book_sequence":70422334944,"remaining":"0","amount":"0.5","price":"90000","tif":"GTC","margin_used":"1900","liquidation":true,"bals":[{"c":"EUR","a":"2000"}]}}]},"orderClosedSpot":{"name":"orderClosedSpot","title":"Order Closed (Spot)","summary":"A spot order was closed, e.g. cancelled. The `type` field (`BOOKED`/`DONE`/`FILL`) is deprecated: use `event` and `status`.","contentType":"application/json","payload":{"$ref":"#/components/schemas/OrderClosedSpot"},"examples":[{"name":"spotCancelled","summary":"Spot buy cancelled","payload":{"channel_name":"TRADING","type":"DONE","event":"ORDER","status":"CANCELLED","instrument_code":"BTC_EUR","client_id":"ca88c44b-3c30-4488-ba03-19c2ddaf9fec","order_id":"2c8c5391-1121-4105-919b-e77586acec04","side":"BUY","order_book_sequence":70422288526,"remaining":"0.1","amount":"0.1","price":"85000","time":1743073077701521400,"bals":[{"c":"BTC","a":"2.5"},{"c":"EUR","a":"20000"}],"lckd_bals":[{"c":"BTC","a":"0"},{"c":"EUR","a":"0"}]}}],"x-docs-gap":"Data schema marks `tif` as required, but the documented example omits it; `tif` is optional here. The field is set by the exchange and passed through unchanged by the WebSocket server, so whether it is always sent cannot be confirmed from that server's code."},"orderClosedFutures":{"name":"orderClosedFutures","title":"Order Closed (Futures)","summary":"A futures order was closed, e.g. cancelled. The `type` field (`BOOKED`/`DONE`/`FILL`) is deprecated: use `event` and `status`.","contentType":"application/json","payload":{"$ref":"#/components/schemas/OrderClosedFutures"},"examples":[{"name":"futuresCancelled","summary":"Futures buy cancelled","payload":{"channel_name":"TRADING","type":"DONE","event":"ORDER","status":"CANCELLED","instrument_code":"BTC_EUR_P","client_id":"c405ca89-72bf-492c-9e6c-beeaed92dfb9","order_id":"e66cf0ef-f4f5-4d55-b485-759e938d041e","side":"BUY","order_book_sequence":70422361957,"remaining":"0.1","amount":"0.1","price":"85000","time":1743074076856974000,"margin_used":"350.5","liquidation":true,"bals":[{"c":"EUR","a":"80000"}]}}],"x-docs-gap":"Data schema marks `tif` as required, but the documented example omits it; `tif` is optional here. The field is set by the exchange and passed through unchanged by the WebSocket server, so whether it is always sent cannot be confirmed from that server's code."},"tradeExecutedSpot":{"name":"tradeExecutedSpot","title":"Trade Executed (Spot)","summary":"A spot order was matched, fully or partially. The `type` field (`BOOKED`/`DONE`/`FILL`) is deprecated: use `event` and `status`.","contentType":"application/json","payload":{"$ref":"#/components/schemas/TradeExecutedSpot"},"examples":[{"name":"spotFill","summary":"Spot taker buy filled","payload":{"channel_name":"TRADING","type":"FILL","event":"ORDER","status":"FILL","instrument_code":"BTC_EUR","client_id":"a4698628-0443-4efd-b14f-2f929a907b66","order_id":"31257543-181a-453b-0bab-c05dfa49631c","time":1743120925007395300,"side":"BUY","order_book_sequence":70467113399,"remaining":"0","amount":"0.00248","trade_id":"37b1c52b-4490-55b0-88ca-1d37f9515d90","matched_as":"TAKER","matched_amount":"0.00248","matched_price_avg":"80620.06","cum_quote_amount":"199.9377488","fee":"0.00000496","fee_currency":"BTC","bals":[{"c":"BTC","a":"10.00611402"},{"c":"EUR","a":"1088100.76854612"}],"lckd_bals":[{"c":"BTC","a":"0"},{"c":"EUR","a":"0"}]}}],"x-docs-gap":"Data schema marks `tif` as required, but the documented example omits it; `tif` is optional here. The field is set by the exchange and passed through unchanged by the WebSocket server, so whether it is always sent cannot be confirmed from that server's code."},"tradeExecutedFutures":{"name":"tradeExecutedFutures","title":"Trade Executed (Futures)","summary":"A futures order was matched, fully or partially. The `type` field (`BOOKED`/`DONE`/`FILL`) is deprecated: use `event` and `status`.","contentType":"application/json","payload":{"$ref":"#/components/schemas/TradeExecutedFutures"},"examples":[{"name":"futuresFill","summary":"Futures taker sell filled","payload":{"channel_name":"TRADING","type":"FILL","event":"ORDER","status":"FILL","instrument_code":"BTC_EUR_P","client_id":"01f133fe-86d9-418f-8b52-86c71f1035d5","order_id":"4539821b-df35-4d6a-21ed-ad1d6efc41fe","time":1743121323027671300,"side":"SELL","order_book_sequence":70467142629,"remaining":"0","amount":"0.00185","trade_id":"739f37ad-7c79-5bba-bc1f-f89c4cc90308","matched_as":"TAKER","matched_amount":"0.00185","matched_price_avg":"80667.3","cum_quote_amount":"149.234505","open_volume":"-0.00247","open_position":"199.273248","fee":"0.29846901","fee_currency":"EUR","margin_used":"38.2479412","liquidation":true,"bals":[{"c":"EUR","a":"962.73779864"}]}}],"x-docs-gap":"Data schema marks `tif` as required, but the documented example omits it; `tif` is optional here. The field is set by the exchange and passed through unchanged by the WebSocket server, so whether it is always sent cannot be confirmed from that server's code."},"orderFullyFilledSpot":{"name":"orderFullyFilledSpot","title":"Order Fully Filled (Spot)","summary":"A spot order has been filled completely. The `type` field (`BOOKED`/`DONE`/`FILL`) is deprecated: use `event` and `status`.","contentType":"application/json","payload":{"$ref":"#/components/schemas/OrderFullyFilledSpot"},"examples":[{"name":"spotFilled","summary":"Spot buy fully filled","payload":{"channel_name":"TRADING","type":"DONE","event":"ORDER","status":"FILLED_FULLY","instrument_code":"BTC_EUR","client_id":"72a56f6c-b323-455a-9182-229bbc1760a2","order_id":"a3baff90-c763-4572-037d-56613d0ca6ba","time":1743122825374527200,"side":"BUY","order_book_sequence":70467252555,"remaining":"0","amount":"0.00185","price_avg":"80846.39","cum_quote_amount":"149.5658215","bals":[{"c":"BTC","a":"10.00796032"},{"c":"EUR","a":"1087951.20272462"}],"lckd_bals":[{"c":"BTC","a":"0"},{"c":"EUR","a":"0"}]}}],"x-docs-gap":"Data schema marks `tif` as required, but the documented example omits it; `tif` is optional here. The field is set by the exchange and passed through unchanged by the WebSocket server, so whether it is always sent cannot be confirmed from that server's code."},"orderFullyFilledFutures":{"name":"orderFullyFilledFutures","title":"Order Fully Filled (Futures)","summary":"A futures order has been filled completely. The `type` field (`BOOKED`/`DONE`/`FILL`) is deprecated: use `event` and `status`.","contentType":"application/json","payload":{"$ref":"#/components/schemas/OrderFullyFilledFutures"},"examples":[{"name":"futuresFilled","summary":"Futures sell fully filled","payload":{"channel_name":"TRADING","type":"DONE","status":"FILLED_FULLY","event":"ORDER","instrument_code":"BTC_EUR_P","client_id":"01f133fe-86d9-418f-8b52-86c71f1035d5","order_id":"4539821b-df35-4d6a-21ed-ad1d6efc41fe","time":1743121323027671300,"side":"SELL","order_book_sequence":70467142629,"remaining":"0","amount":"0.00185","price_avg":"80667.3","cum_quote_amount":"149.234505","margin_used":"38.2479412","liquidation":true,"bals":[{"c":"EUR","a":"962.73779864"}]}}],"x-docs-gap":"Data schema marks `tif` as required, but the documented example omits it; `tif` is optional here. The field is set by the exchange and passed through unchanged by the WebSocket server, so whether it is always sent cannot be confirmed from that server's code."},"orderMoved":{"name":"orderMoved","title":"Order Moved","summary":"A MOVE_ORDER request was accepted. The `type` field (`BOOKED`/`DONE`/`FILL`) is deprecated: use `event` and `status`.","contentType":"application/json","payload":{"$ref":"#/components/schemas/OrderMoved"},"examples":[{"name":"moved","summary":"SOL_EUR buy moved to 49","payload":{"channel_name":"TRADING","type":"DONE","event":"ORDER","status":"MOVED","instrument_code":"SOL_EUR","client_id":"436afcec-7d88-4e8d-ac45-3439e3aed490","order_id":"a9ed7098-4f53-455a-9dc9-70444e8950a1","order_book_sequence":71089343164,"side":"BUY","price":"49","amount":"1","remaining":"1","bals":[{"c":"SOL","a":"10000000"},{"c":"EUR","a":"1009950"}],"lckd_bals":[{"c":"SOL","a":"0"},{"c":"EUR","a":"100"}],"time":1743892870022076400}}],"x-docs-gap":"Data schema 412126 swaps the descriptions of `client_id` and `order_id`; corrected here."},"marginUpdate":{"name":"marginUpdate","title":"Margin Update","summary":"Your futures margin status moved into a new category.","description":"Triggered whenever the ratio between available margin and maintenance margin requirement moves into a new status category:\n\n- `ACTIVE` (ratio > 1.5): sufficient margin; no immediate action required.\n- `DERISK` (1.0 < ratio ≤ 1.5): nearing the maintenance margin threshold; reduce open positions or add margin.\n- `LIQUIDATION` (ratio ≤ 1.0): below the maintenance margin requirement; positions are liquidated to bring the account back into compliance.","contentType":"application/json","payload":{"$ref":"#/components/schemas/MarginUpdate"},"examples":[{"name":"liquidation","summary":"Account entered LIQUIDATION","payload":{"channel_name":"TRADING","type":"MARGIN_UPDATE","cash_balance":"3000","maintenance_margin":"525","margin_used":"3000","estimated_profit":"-3000","ratio":0.79,"status":"LIQUIDATION"}}],"x-docs-gap":"Data schema 408021 types `ratio` as a string, but the example sends a number (0.79); this spec follows the example. The field is set by the exchange and passed through unchanged by the WebSocket server, so its type cannot be confirmed from that server's code."},"settlement":{"name":"settlement","title":"Settlement","summary":"Minutely settlement of an open futures position.","description":"Sent every minute for any account with an open futures position.","contentType":"application/json","payload":{"$ref":"#/components/schemas/Settlement"},"examples":[{"name":"longSettlement","summary":"BTC_EUR_P long position settled","payload":{"type":"SETTLEMENT","channel_name":"TRADING","instrument_code":"BTC_EUR_P","time":1737993490000000000,"direction":"LONG","open_position":"1030","open_volume":"0.01","pending_buy_size":"0","pending_sell_size":"0","profit":"1.13","total_profit":"1250","account_ratio":"2.57","maintenance_margin":"595","quote_currency_balance":"5000","margin_used":"101","mark_price":"103000"}}],"x-docs-gap":"`open_position` has no description in data schema 408022. The field is set by the exchange and passed through unchanged by the WebSocket server, so its meaning cannot be confirmed from that server's code."},"fundingPayment":{"name":"fundingPayment","title":"Funding Payment","summary":"Funding rate payment on a futures position, every four hours.","contentType":"application/json","payload":{"$ref":"#/components/schemas/FundingPayment"},"examples":[{"name":"shortFunding","summary":"Funding Payment page example","payload":{"type":"FUNDING_PAYMENT","channel_name":"TRADING","instrument_code":"BTC_EUR_P","direction":"SHORT","open_volume":"0.03","pending_buy_size":"0","pending_sell_size":"0.05","funding_rate":"1","funding_payment":"-15.3","cash_balance":"100015.3","maintenance_margin":"53.55","maintenance_used":"153","account_ratio":0.46}},{"name":"longFunding","summary":"Balance Adjustment page example","payload":{"channel_name":"TRADING","type":"FUNDING_PAYMENT","event":"ACCOUNT","status":"WITHDRAWN","instrument_code":"BTC_EUR_P","direction":"LONG","open_volume":"1.02","open_position":"90200.50","pending_buy_size":"0","pending_sell_size":"0","funding_rate":"0.0002","funding_payment":"1.84","cash_balance":"98378.71","maintenance_margin":"1000","margin_used":"6621.295","account_ratio":14.85}}],"x-docs-gap":"Two different shapes are documented: the Funding Payment page (data schema 408070) has `maintenance_used`, while the Balance Adjustment page example has `margin_used`, `open_position`, `event` and `status` instead. Fields from the second example have no descriptions. The message is set by the exchange and passed through unchanged by the WebSocket server, so which shape is current cannot be confirmed from that server's code."},"balanceAdjustment":{"name":"balanceAdjustment","title":"Balance Adjustment","summary":"A deposit or withdrawal changed your balance.","contentType":"application/json","payload":{"$ref":"#/components/schemas/BalanceAdjustment"},"examples":[{"name":"deposit","summary":"Deposit","payload":{"channel_name":"TRADING","type":"BALANCE_ADJUSTMENT","event":"ACCOUNT","status":"DEPOSITED","instrument_code":"EUR","time":1743162435279363800,"amount":"1000","new_balance":"93000.9853496","assigned_margin":"0"}},{"name":"withdrawal","summary":"Withdrawal","payload":{"channel_name":"TRADING","type":"BALANCE_ADJUSTMENT","event":"ACCOUNT","status":"WITHDRAWN","instrument_code":"EUR","time":1743162442497232100,"amount":"-2000","new_balance":"91000.9853496","assigned_margin":"0"}}],"x-docs-gap":"No data schema or field descriptions for BALANCE_ADJUSTMENT. The message is set by the exchange and passed through unchanged by the WebSocket server, so its shape cannot be confirmed from that server's code."},"subscribeAccount":{"name":"subscribeAccount","title":"Subscribe to Account","summary":"Client subscribes to the ACCOUNT channel.","description":"Requires a prior successful `AUTHENTICATE`. One subscription covers your main account and every subaccount.","contentType":"application/json","payload":{"$ref":"#/components/schemas/SubscribeAccount"},"examples":[{"name":"account","summary":"Subscribe to the ACCOUNT channel","payload":{"type":"SUBSCRIBE","channels":[{"name":"ACCOUNT"}]}}]},"accountSubscribed":{"name":"accountSubscribed","title":"Account Subscribed","summary":"Server confirms the ACCOUNT subscription.","contentType":"application/json","payload":{"$ref":"#/components/schemas/AccountSubscribed"},"examples":[{"name":"accountSubscribed","summary":"Subscribed to the ACCOUNT channel","payload":{"type":"SUBSCRIPTIONS","channels":[{"name":"ACCOUNT","account_id":"726288e6-a463-4f88-9068-024ae8f97a34"}],"time":1763288100299000000}}]},"exoticOrderRegistered":{"name":"exoticOrderRegistered","title":"Exotic Order Registered","summary":"A take profit / stop loss (TP/SL) was created.","description":"Sent when a TP/SL is created: attached to an order with Create Order, or on its own with Create Exotic Order (TP/SL). A TP/SL attached to an order is `PENDING` until the order fills. One created on an open position is `ACTIVE` at once, and `EXOTIC_ORDER_ACTIVATED` follows straight away.","contentType":"application/json","payload":{"$ref":"#/components/schemas/ExoticOrderRegistered"},"examples":[{"name":"registered","summary":"Position stop loss registered","payload":{"channel_name":"ACCOUNT","type":"EXOTIC_ORDER","time":"2026-11-16T10:15:00.512Z","account_id":"726288e6-a463-4f88-9068-024ae8f97a34","event_type":"EXOTIC_ORDER_REGISTERED","event_timestamp":"2026-11-16T10:15:00.000Z","data":{"client_id":"0d0b1f0c-7f0e-4f55-9a53-6f6f3c1c2a10","instrument_code":"BTC_USD_P","status":"PENDING","order_kind":"TPSL","tpsl_mode":"position","activation_source":"order_fill","take_profit_price":null,"stop_loss_price":65000,"tp_client_id":"c2a7a1de-6d0b-11f0-8de9-0242ac120002","sl_client_id":"1f06d0b6-a7a1-6e20-8de9-0242ac120002","version":2}}}]},"exoticOrderUpdated":{"name":"exoticOrderUpdated","title":"Exotic Order Updated","summary":"The levels of a TP/SL were changed.","description":"Sent when the levels of a TP/SL are changed with Update Exotic Order (TP/SL). `data` already carries the new levels. An update that removes the last level cancels the TP/SL: `EXOTIC_ORDER_CANCELLED` is sent instead, with reason `TP_SL_REMOVED`.","contentType":"application/json","payload":{"$ref":"#/components/schemas/ExoticOrderUpdated"},"examples":[{"name":"updated","summary":"Stop loss raised to 66500","payload":{"channel_name":"ACCOUNT","type":"EXOTIC_ORDER","time":"2026-11-16T10:42:07.512Z","account_id":"726288e6-a463-4f88-9068-024ae8f97a34","event_type":"EXOTIC_ORDER_UPDATED","event_timestamp":"2026-11-16T10:42:07.000Z","data":{"client_id":"0d0b1f0c-7f0e-4f55-9a53-6f6f3c1c2a10","instrument_code":"BTC_USD_P","status":"ACTIVE","order_kind":"TPSL","tpsl_mode":"position","activation_source":"order_fill","take_profit_price":null,"stop_loss_price":66500,"tp_client_id":"c2a7a1de-6d0b-11f0-8de9-0242ac120002","sl_client_id":"1f06d0b6-a7a1-6e20-8de9-0242ac120002","version":2}}}]},"exoticOrderActivated":{"name":"exoticOrderActivated","title":"Exotic Order Activated","summary":"A TP/SL became ACTIVE: its levels are now watched.","description":"A TP/SL attached to an order arms when the order first fills. A position TP/SL created on an open position arms as it is created. If a level has already been reached at that moment, the TP/SL is not armed: `EXOTIC_ORDER_CANCELLED` is sent instead, with reason `VALIDATION_FAILED_AT_ACTIVATION`.","contentType":"application/json","payload":{"$ref":"#/components/schemas/ExoticOrderActivated"},"examples":[{"name":"activated","summary":"Position stop loss armed","payload":{"channel_name":"ACCOUNT","type":"EXOTIC_ORDER","time":"2026-11-16T10:15:02.512Z","account_id":"726288e6-a463-4f88-9068-024ae8f97a34","event_type":"EXOTIC_ORDER_ACTIVATED","event_timestamp":"2026-11-16T10:15:02.000Z","data":{"client_id":"0d0b1f0c-7f0e-4f55-9a53-6f6f3c1c2a10","instrument_code":"BTC_USD_P","status":"ACTIVE","order_kind":"TPSL","tpsl_mode":"position","activation_source":"order_fill","take_profit_price":null,"stop_loss_price":65000,"tp_client_id":"c2a7a1de-6d0b-11f0-8de9-0242ac120002","sl_client_id":"1f06d0b6-a7a1-6e20-8de9-0242ac120002","entry_side":"BUY","close_side":"SELL","filled_amount":1.5,"version":2}}}]},"exoticOrderTriggered":{"name":"exoticOrderTriggered","title":"Exotic Order Triggered","summary":"A TP/SL level was reached; its close is about to be placed.","description":"Sent just before the close is placed. From here the TP/SL can no longer be updated or cancelled.\n\nA futures close is planned as one or more reduce-only limit orders, each within the instrument's `max_order_value`, all listed in `close_orders`. They are sent one at a time, a short delay apart, and each appears on the TRADING channel under its own `client_id`.\n\nA spot close is a single sell order under the TP/SL's `tp_client_id` or `sl_client_id`: its message carries no `position_id`, `limit_price` or `close_orders`.\n\nThis message can be delivered more than once with the same `message_id`: deduplicate on it.","contentType":"application/json","payload":{"$ref":"#/components/schemas/ExoticOrderTriggered"},"examples":[{"name":"futuresStopLoss","summary":"Futures stop loss triggered","payload":{"channel_name":"ACCOUNT","type":"EXOTIC_ORDER","time":"2026-11-16T12:30:41.512Z","account_id":"726288e6-a463-4f88-9068-024ae8f97a34","event_type":"EXOTIC_ORDER_TRIGGERED","event_timestamp":"2026-11-16T12:30:41.000Z","message_id":"54a0a5cf-bc22-4419-a2af-9038386916d3","data":{"client_id":"0d0b1f0c-7f0e-4f55-9a53-6f6f3c1c2a10","instrument_code":"BTC_USD_P","status":"TRIGGERED","trigger_source":"SL","trigger_price":65000,"actual_trigger_price":64998.5,"close_amount":"1.5","close_side":"SELL","tp_client_id":"c2a7a1de-6d0b-11f0-8de9-0242ac120002","sl_client_id":"1f06d0b6-a7a1-6e20-8de9-0242ac120002","position_id":"1b0f6f5e-2a59-4f0a-9d0e-5f7f3f0f6a11","limit_price":"61750","close_orders":[{"client_id":"1f0c2f6a-5b7e-6d10-9c1e-0242ac120002","amount":"0.70175"},{"client_id":"1f0c2f6a-5b7e-6d11-9c1e-0242ac120002","amount":"0.70175"},{"client_id":"1f0c2f6a-5b7e-6d12-9c1e-0242ac120002","amount":"0.0965"}],"version":2}}}]},"exoticOrderExecuted":{"name":"exoticOrderExecuted","title":"Exotic Order Executed","summary":"A triggered TP/SL finished its close and is now COMPLETE.","description":"- **Futures:** sent once the close has finished: all it set out to close is closed, or the position is gone. `closure_status` is `CLOSED`, and `close_orders` reports what each order of the close filled.\n- **Spot:** sent once the exchange accepts the sell order. Its fills arrive on the TRADING channel; the message carries no `closure_status`, `position_id`, `open_volume`, `filled_amount` or `close_orders`.\n\nA futures close that stops before it finishes is reported with `EXOTIC_ORDER_CANCELLED` instead.","contentType":"application/json","payload":{"$ref":"#/components/schemas/ExoticOrderExecuted"},"examples":[{"name":"futuresExecuted","summary":"Futures stop loss close completed","payload":{"channel_name":"ACCOUNT","type":"EXOTIC_ORDER","time":"2026-11-16T12:30:43.512Z","account_id":"726288e6-a463-4f88-9068-024ae8f97a34","event_type":"EXOTIC_ORDER_EXECUTED","event_timestamp":"2026-11-16T12:30:43.000Z","data":{"client_id":"0d0b1f0c-7f0e-4f55-9a53-6f6f3c1c2a10","instrument_code":"BTC_USD_P","status":"COMPLETE","trigger_source":"SL","close_amount":"1.5","close_side":"SELL","tp_client_id":"c2a7a1de-6d0b-11f0-8de9-0242ac120002","sl_client_id":"1f06d0b6-a7a1-6e20-8de9-0242ac120002","closure_status":"CLOSED","position_id":"1b0f6f5e-2a59-4f0a-9d0e-5f7f3f0f6a11","open_volume":"0","filled_amount":"1.5","close_orders":[{"client_id":"1f0c2f6a-5b7e-6d10-9c1e-0242ac120002","amount":"0.70175","status":"FILLED_FULLY","order_id":"7d1c3a52-0c7b-4a55-8f6e-2f1a9b3c4d5e","filled_amount":"0.70175"},{"client_id":"1f0c2f6a-5b7e-6d11-9c1e-0242ac120002","amount":"0.70175","status":"FILLED_FULLY","order_id":"8e2d4b63-1d8c-4b66-9a7f-3a2b0c4d5e6f","filled_amount":"0.70175"},{"client_id":"1f0c2f6a-5b7e-6d12-9c1e-0242ac120002","amount":"0.0965","status":"FILLED_FULLY","order_id":"9f3e5c74-2e9d-4c77-8b80-4b3c1d5e6f70","filled_amount":"0.0965"}],"version":2}}}]},"exoticOrderCancelled":{"name":"exoticOrderCancelled","title":"Exotic Order Cancelled","summary":"A TP/SL ended without completing a close.","description":"`reason` says why. A futures close that stopped before it finished (`previous_status` is `TRIGGERED`) also reports what it did, in the same fields as `EXOTIC_ORDER_EXECUTED`. Whatever it did not close stays open: nothing is retried later.\n\n| `reason` | Meaning |\n|---|---|\n| `USER_CANCELLED` | You cancelled it by `client_id`. Also sent when the order of a Create Order request was rejected, and its attached TP/SL was removed. |\n| `BROKER_CANCELLED` | Your broker cancelled it. |\n| `BULK_CANCEL` | You cancelled the instrument's TP/SLs by `instrument_code`. |\n| `TP_SL_REMOVED` | An update removed its last level. |\n| `FORCE_REPLACED` | A new position TP/SL sent with `tpsl_force` replaced it. |\n| `ORDER_CLOSED` | The order it was attached to was cancelled, or closed without a fill, before the TP/SL armed. |\n| `ORDER_REJECTED` | The exchange rejected the order it was attached to. |\n| `VALIDATION_FAILED_AT_ACTIVATION` | A level had already been reached when the TP/SL armed, so it could never fire. The message carries `failed_legs` and `reference_mid`. |\n| `POSITION_CLOSED` | The position it protected was closed. |\n| `POSITION_FLIPPED` | A trade reversed the position (a long became a short, or the other way round), so its levels no longer apply. |\n| `NO_OPEN_POSITION` | A level was reached with no position left to close. |\n| `INSUFFICIENT_LIQUIDITY` | Futures close: every planned order went out, and part of what it set out to close is still open. |\n| `EXCHANGE_REJECTED` | The exchange refused a close order. |\n| `PRICE_OUT_OF_COLLAR` | When a level was reached, the exchange's price collar refused the limit price of the order it placed. Retrying cannot help: create a new one. |\n| `MARKET_NOT_ACTIVE` | A level was reached while the market was not taking orders (suspended, closed or post-only). |\n| `MAX_RETRIES_EXHAUSTED` | The close could not be placed after its retries. |\n| `SPOT_SELL_UNSUPPORTED` | Spot: the order it was attached to filled as a sell. A spot TP/SL only protects a buy. |\n| `NO_BALANCE` | Spot: a level was reached with none of the bought asset left to sell. |\n| `BELOW_MIN_ORDER_VALUE` | Spot: a level was reached, but the sell would be worth less than the market's minimum order value. |\n\nNew reasons may be added: treat one you do not recognise as a cancellation.","contentType":"application/json","payload":{"$ref":"#/components/schemas/ExoticOrderCancelled"},"examples":[{"name":"userCancelled","summary":"Cancelled by the user","payload":{"channel_name":"ACCOUNT","type":"EXOTIC_ORDER","time":"2026-11-16T11:02:10.512Z","account_id":"726288e6-a463-4f88-9068-024ae8f97a34","event_type":"EXOTIC_ORDER_CANCELLED","event_timestamp":"2026-11-16T11:02:10.000Z","data":{"client_id":"0d0b1f0c-7f0e-4f55-9a53-6f6f3c1c2a10","instrument_code":"BTC_USD_P","status":"CANCELLED","previous_status":"ACTIVE","reason":"USER_CANCELLED","version":2}}},{"name":"partiallyClosed","summary":"Futures close stopped: insufficient liquidity","payload":{"channel_name":"ACCOUNT","type":"EXOTIC_ORDER","time":"2026-11-16T12:30:43.512Z","account_id":"726288e6-a463-4f88-9068-024ae8f97a34","event_type":"EXOTIC_ORDER_CANCELLED","event_timestamp":"2026-11-16T12:30:43.000Z","data":{"client_id":"0d0b1f0c-7f0e-4f55-9a53-6f6f3c1c2a10","instrument_code":"BTC_USD_P","status":"CANCELLED","previous_status":"TRIGGERED","reason":"INSUFFICIENT_LIQUIDITY","closure_status":"PARTIALLY_CLOSED","position_id":"1b0f6f5e-2a59-4f0a-9d0e-5f7f3f0f6a11","open_volume":"0.4","filled_amount":"1.1","close_orders":[{"client_id":"1f0c2f6a-5b7e-6d10-9c1e-0242ac120002","amount":"0.70175","status":"FILLED_FULLY","order_id":"7d1c3a52-0c7b-4a55-8f6e-2f1a9b3c4d5e","filled_amount":"0.70175"},{"client_id":"1f0c2f6a-5b7e-6d11-9c1e-0242ac120002","amount":"0.70175","status":"INSUFFICIENT_LIQUIDITY","order_id":"8e2d4b63-1d8c-4b66-9a7f-3a2b0c4d5e6f","filled_amount":"0.39825"},{"client_id":"1f0c2f6a-5b7e-6d12-9c1e-0242ac120002","amount":"0.0965","status":"INSUFFICIENT_LIQUIDITY","order_id":"9f3e5c74-2e9d-4c77-8b80-4b3c1d5e6f70","filled_amount":"0"}],"version":2}}}]}}}}