Skip to main content

Subscribe 24H Trades Summary for All Instruments

API Description​

This Websocket API provides real-time spot market instrument, streaming live bid and ask data.

Note: 24H Trade Summary data is accessible via both RESTful and Websocket APIs. This page describes the Websock API. For information on the RESTful API, please click here

Precautions​

  1. This websocket returns the real time data for all trading instruments listed on exchange.
  2. Only method 2 is available to achieve this functionality.

Authentication​

This is a public Websocket and does not require authentication. For details on using the Websocket API, please refer to Common > Authentication & Code Snippet > Spot > Websocket Public Interface > Method 2

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.
paramstrueJsonRequested parameter objects including:
-biztrueStringSpecifies the channel, e.g., "exchange".
Note: Lowercase is recommended.
-typetrueStringDefines the function type, e.g., "ticker_all".
Note: Lowercase is recommended.

Response Parameters​

ParameterTypeDescription
bizStringChannel name, e.g., "exchange".
channelStringSubscription type, e.g., "subscribe".
typeStringDefines the function type, e.g., "ticker_all".
-resultBooleanResult of the subscription request:
true/false.
dataJsonData object, containing the following fields:
-activityStateIntegerState of the activity (specific meaning not provided).
-currencyVolBigDecimalTotal volume of currency traded.
-fPartitionIdsStringIDs related to market or platform partitioning.
-favBooleanWhether the coin pair is marked as a favorite.
-hotCoinSortIntegerRanking of the coin based on popularity or trading volume.
-leftCoinNameStringName of the base currency of the instrumnet, i.e., BTC
-leftCoinUrlStringURL to the image of the left coin.
-newCoinSortIntegerSorting rank of the coin in new listings ( users can ignore it)
-oneDayHighestBigDecimalHighest price of the coin in the last 24 hours.( in quote currency)
-oneDayLowestBigDecimalLowest price of the coin in the last 24 hours.(in quote currency)
-oneDayTotalBigDecimalTotal amount of the coin traded in the last 24 hours. ( in base currency)
-priceBigDecimalLatest price in quote currency.
-rightCoinNameStringName of the quote currency of the instrumnet, i.e., USDT
-roseBigDecimalPercentage change in price in terms of quote currency.
-selectiveBooleanIndicates if the data is selective for specific conditions. ( users can ignore it)
-symbolStringCurrency symbol used for pricing (e.g., "$").
-tmIdIntegerCurrency pair ID, i.e., 78 : BTC_USDT
Note: The mapping between currency pair ID and trading instrument can be obtained through Get 24H Trade Summary for All Instruments interface.
-transferPriceBigDecimalTransfer price ( users can ignore it)
-transferSymbolStringSymbol for the converted currency ( users can ignore it)

Subscription Example​

The following Python code shows how to subscribe for BTC-USDT.

Note: For a complete code example, please refer to Common > Authentication & Code Snippet > Spot > Websocket Public Interface > Method 2.

url = "wss://ws.futurescw.com"
subscription_params = {"event":"sub",
"params":{
"biz":"exchange",
"type":"ticker_all"}}
SpotWebsocketPublic(url, subscription_params) # the function SpotWebsocketPublic() is defined in section (Common > Authentication & Code Snippet > Spot > Websocket Public Interface > Method 2)

Note: For a complete Java code example, please refer to Common > Authentication & Code Snippet > Spot > Websocket Public Interface > Method 2.

Response Example​

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

{"biz":"exchange","data":{"result":true},"channel":"subscribe","type":"ticker_all"}

{"biz":"exchange","data":"[{\"activityState\":0,\"currencyVol\":604768021.9400,\"fPartitionIds\":\"1,2006\",\"fav\":false,\"hotCoinSort\":46,\"leftCoinName\":\"BTC\",\"leftCoinUrl\":\"https://hkto-prod.oss-accelerate.aliyuncs.com/201810020046047_T9g8i.png\",\"newCoinSort\":0,\"oneDayHighest\":\"94827.32\",\"oneDayLowest\":\"92788.41\",\"oneDayTotal\":\"6434.1919000000\",\"price\":\"94728.91\",\"rightCoinName\":\"USDT\",\"rose\":\"0.0063\",\"selective\":false,\"symbol\":\"$\",\"tmId\":78,\"transferPrice\":\"664049.6591\",\"transferSymbol\":\"¥\"},.........]","type":"ticker_all"},........