Market

MarketQuoteMarket

Interface Description

The interface feature is that for each websocket connection, each time the request is sent, the backend will overwrite the previous subscription request by default. After the subscription is successful, data will be pushed.

Request-Protocol Number: 14010

Data format:json

Data Structure

data definition

Fields

name

type

Required fields

illustrate

symbol_list

Product List

array

yes

See the symbol definition below for the specific format

Symbol definition

Fields

name

type

Required fields

illustrate

symbol_id

Product ID

uint64

yes

trade_type

Transaction Type

uint32

yes

1: Full position contract, 2: Isolated position contract, 3: Leverage, 5: Spot, 6: Stock

trade_mode

Trading Model

uint32

yes

1:MM, 2:ButterflyMM, 3:Matchmaking, 4:Aggregation

depth_level

Depth level

uint32

no

If there is no depth_level field, the backend will only provide a quote for one level. The requested level is greater than the actual quote level. If there is no depth_level field, the backend will provide a quote for as many levels as the actual quote level has.

merge_accuracy

Merge precision

string

yes

If the value is 10, it means the quotation will be combined according to the tenth digit; if it is 1, it means the quotation will be combined according to each decimal place; if it is 0.001, it means the quotation will be combined according to the third decimal place, and so on.

trade_info_count

Number of transaction information

uint32

yes

Indicates how many transaction quotes you want to receive in response to your subscription.

Request Example

Copy

{
    "cmd_id":14010,
    "seq_id":123,
    "ext":"3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
    "data":{
        "symbol_list": [
            {
		"symbol_id": 112312,
		"trade_type": 1,
                "trade_mode": 0,
                "depth_level": 5,
                "merge_accuracy":"0.001",
                "trade_info_count": 5,
            },
	],
    }
}

Response-Protocol Number: 14011

Data format:json

Data Structure

data definition

Fields

name

type

illustrate

tick_list

tick snapshot data

array

See the tick definition below for the specific format

Tick ​​definition

Fields

name

type

illustrate

symbol_id

Product ID

uint64

trade_type

Transaction Type

uint32

1: Full position contract, 2: Isolated position contract, 3: Leverage, 5: Spot, 6: Stock

trade_mode

Trading Model

uint32

1:MM, 2:ButterflyMM, 3:Matchmaking, 4:Aggregation

seq

Quotation number

uint64

tick_time

Quote timestamp

uint64

price_digits

Price decimal places

uint32

bid_deep

bid depth

array

See the definition of bid_deep below. The number of depths will vary depending on the depth_level and merge_accuracy in the request.

ask_deep

askDepth

array

See the definition of ask_deep below. The number of depths will vary depending on the depth_level and merge_accuracy in the request.

trade_info

Transaction information

array

See trade_info definition below

bid_deep definition

Fields

name

type

illustrate

price_bid

Buy price, buy price

string

volume_bid

Buy one volume, buy volume

string

ask_deep definition

Fields

name

type

illustrate

price_ask

Selling price, selling price

string

volume_ask

Selling volume, selling volume

string

trade_info definition

Fields

name

type

illustrate

price

Sold Price

string

volume

Volume

string

trade_direction

Trading direction

uint32

0 is the default value, 1 is BUY, 2 is SELL

trade_time

Transaction timestamp

uint64

Unit: Seconds

Example Response

Copy

{
    "ret":200,
    "msg":"ok",
    "cmd_id":14011,
    "seq_id":123,
    "ext":"3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
    "data":{
        "tick_list":[
            {
		"symbol_id": 123,
		"trade_type": 1,
                "trade_mode": 0,
		"seq": 1605509068000001,
		"tick_time": 1605509068,
                "price_digits": 2,
		"bid_deep": [
                    {
			"price_bid": "9.12",
                        "volume_bid": "9.12",
                    },
		],
                "ask_deep": [
                    {
			"price_ask": "147.12",
			"volume_ask": "147.12",
                    },
		],
                "trade_info": [
                    {
			"price": "651.12",
                        "volume": "100",
                        "trade_direction": 1,
                        "trade_time": 1605509068,
                    },
		]
            },
        ]
    }    
}

Push data - real-time transaction quotation push

illustrate

The quotation push mainly reflects the transaction information. The push data content is a string. Currently, one quotation is pushed at a time. The backend service will push the data to the requester only after the requester sends a quotation subscription request.

Field Explanation

pt(product ID, quote transaction type, transaction mode, quote sequence number, quote timestamp, current price, transaction volume, transaction direction); "pt(symbol_id,trade_type,trade_mode,seq,tick_time,price,volume,trade_direction);" trade_type value meaning 1: full position contract, 2: single position contract, 3: leverage, 5: spot, 6: stock trade_mode value meaning 1: MM, 2: butterfly MM, 3: matching, 4: aggregation

Push data example

"pt(1123,1,0,1232312,34545435345,6.23,1000,1);"

Push data-market quote push

illustrate

The quote push mainly reflects the market information, and will merge the deep quotes according to the merge precision field in the subscription request. The push data content is a string, and currently one quote is pushed at a time. The backend service will push the data to the requester only after the requester sends a market transaction quote subscription request.

Field Explanation

pd(product ID, quotation transaction type, transaction mode, quotation sequence number, quotation timestamp);(1st tier bid price, 1st tier bid volume)(2nd tier bid price, 2nd tier bid volume);(1st tier ask price, 1st tier ask volume)(2nd tier ask price, 2nd tier ask volume); "pd(symbol_id,trade_type,trade_mode,seq,tick_time);(price_bid1,volume_bid1)(price_bid2,volume_bid2);(price_ask1,volume_ask1)(price_ask2,volume_ask2);" trade_type value meaning 1: full position contract, 2: single position contract, 3: leverage, 5: spot, 6: stock trade_mode value meaning 1: MM, 2: butterfly MM, 3: matching, 4: aggregation

Push data example

"pd(1123,1,0,1232312,34545435345);(6.23,123)(6.22,256);(6.24,111)(6.25,222);" "pd(1123,1,0,1232312,34545435345) ;(6.23,123)(6.22,256);(6.24,111)(6.25,222)(6.25,333);" "pd(1123,1,0,1232312,34545435345);;(6.24,111)( 6.25,222)(6.25,333);"

Last updated