Skip to main content

Subscribe Current Orders

API Description

This Websocket allows users to subscribe to real-time updates for all current orders, including both market and limit orders.

Note: Current orders data is accessible via both RESTful and Websocket APIs. This page describes the Websocket API. For information on the RRESTful API, please click here

Precautions

  1. The Websocket connection does not return any response unless new orders are placed or there is a change in order status. If no changes occur, the Websocket will not provide updates. Users should ensure that they have active trading activity to receive real-time updates.
  2. For market orders, the "side" parameter in the response will return an empty string.

Authentication

This is a private interface and requires authentication. For details on using the RESTful API, please refer to Introduction > Authentication & Code Snippet > Spot > Websocket Private Interface.

Websocket URL

wss://ws.futurescw.com

Frequency Limit

None

Subscription Parameters

ParameterMandatoryTypeDescription
eventtrueStringSubscribe or unsubscribe:
sub: subscribe
unsub: unsubscribe
Note: This parameter is case-sensitive.
paramstrueJsonData object containing the following:
-biztrueStringSpecifies the channel, e.g.,"exchange"
-typetrueStringDefines the function type, e.g., "order"

Response Parameters

ParameterTypeDescription
bizStringSpecifies the channel, e.g.,"exchange"
typeStringDefines the function type, e.g., "order"
dataArrayData object
-feeStringHandling fee
-dealFundsStringOrder amount
-typeStringOrder success:Done
-timeLongOrder time (timestamp)
-product_idStringInstrument, i.e., BTC-USDT
-order_idStringOrder ID
-client_idStringA custom order ID assigned by the user
-sizeStringOrder size in base currency
-remaining_sizeStringRemaining order size in base currency
-priceStringOrder price specified by user:Note: For market orders, it represents the market price.
-sideStringTrade direction: BUY/SELL
-order_typeStringOrder type: LIMIT - limit price, MARKET - market price
-reasonStringReason:Cancelled/Filled
-dealAvgPriceStringAverage price

Subscription Example

The following Python code shows how to subscribe to the current orders.

Note: For a complete code example, please refer to Introduction > Authentication & Code Snippet > Spot > Websocket Private Interface.

url = "wss://ws.futurescw.com"
subscription_payload = {"event": "sub",
"params": {"biz": "exchange",
"type": "order"}}
api_key= "your_api_key"
sec_key = "your_sec_key"
SpotWebsocketPrivate(url, subscription_payload, api_key, sec_key) # function SpotWebsocketPrivate() is defined in section (Introduction > Authentication & Code Snippet > Spot > Websocket Private Interface)

Note: For a complete Java code example, please refer to Introduction > Authentication & Code Snippet > Spot > Websocket Private Interface.

Response Example

The following is an example response returned by the above Python subscription. The Websocket subscription will keep updating he current orders in real-time. For brevity, only the one order information is provided below:

{'data': {'result': True}, 'channel': 'login'}
{'biz': 'exchange', 'data': {'result': True}, 'channel': 'subscribe', 'type': 'order'}
{'biz': 'exchange',
'data': {'side': 'BUY',
'fee': '0',
'dealFunds': '0',
'type': 'RECEIVED',
'client_id': 'you*******',
'remaining_size': '0.0001',
'size': '0.0001',
'price': '82000',
'product_id': 'BTC_USDT',
'time': 1743244437255,
'order_id': 4624530513294751114,
'order_type': 'LIMIT'},
'type': 'order'},.....