Subscribe Incremental Market Depth Data

market.$contract_code.depth.size_${size}.high_freq

Signature verification: No

Interface permission: Read

Rate Limit: For public interface to get market data such as Get Kline data, Get Market Data Overview, Get Contract Information,Get market in-depth data, Get premium index Kline, Get real-time forecast capital rate kline, Get basis data, Get the last Trade of a Contract and so on: For websocket: The rate limit for “req” request is 50 times at once. No limit for “sub” request as the data will be pushed by sever voluntarily.

Interface description: The interface supports cross margin mode and isolated margin mode. The request parameter "contract_code" supports the contract code of futures, in that the format is BTC-USDT-210625; and supports contract type: BTC-USDT, BTC-USDT-CW, BTC-USDT-NW, BTC-USDT-CQ, BTC-USDT-NQ.

Subscription Address

Environment
Address

Online

wss://api.sunx.io/ws/v1/market

Online (preferred by aws customers)

wss://api.sunx.io/ws/v1/market

Subscription Parameter

Parameter
Data Type
Required
Description
Value Range
Default Value

contract_code

string

true

contract code or contract type

swap: "BTC-USDT"... , future: "BTC-USDT-210625" ... or BTC-USDT-CW, BTC-USDT-NW, BTC-USDT-CQ, BTC-USDT-NQ

size

string

true

Depth size

20: stands for 20 unmerged data. 150:stands for 150 unmerged data.

Data Update

Parameter
Data Type
Required
Description
Value Range

ts

string

true

Timestamp of Respond Generation, Unit: Millisecond

ch

long

true

Data channel, Format:market.$contract_code.depth.size_${size}.high_freq

<tick>

false

mrid

long

true

Order ID

id

long

true

tick ID,system timestamp.seconds

asks

object

true

Sell,[price(Ask price), vol(Ask orders (cont.) )], price in ascending sequence

bids

object

true

Buy,[price(Bid price), vol(Bid orders(Cont.))], Price in descending sequence

ts

long

true

Timepoint for system detecting orderbook, unit: millisecond

version

long

true

version ID,auto increment ID.

event

string

true

event type: update or snapshot

ch

string

true

Data channel, Format: market.$contract_code.depth.size_${size}.high_freq

</tick>

false

Notes: when data_type is incremental,snapshot data wil be pushed for the first time. When re-connection occurs, snapshort data will be pushed for the first time. version: auto increment in single websocket connection. version may be different among several websocket subscription connections. orderbook will be pushed if orderbook is updated whenever incremental or snapshot. orderbook event will be checked every 30ms. If there is no orderbook event, you will not receive any orderbook data. you HAVE TO maintain local orderbook data,such as updating your local orderbook bids and asks data.

Subscription Example

Example of a Successful Subscription

Example of a Data Update

Example of a Subscription Cancellation

Last updated