# Contract Market

# K-Line

Title: PUBLIC@CONTRACT_KLINE?SYMBOL&PERIOD

Module Type Resource Isolation Type
Contract Market(CONTRACT_MARKET) Query(QUERY) Trading Pair(SYMBOL)

# Subscription Parameters

Name Description Example Value
SYMBOL Trading Pair BTC/USDT, etc. Please use the RestAPI contract trading pair configuration interface to retrieve all supported trading pairs
PERIOD Candlestick Interval 1MIN:1-minute candlestick, 5MIN:5-minute candlestick, 15MIN:15-minute candlestick, 30MIN:30-minute candlestick, 60MIN:1-hour candlestick,4HOUR:4-hour candlestick,1DAY:daily candlestick,1MON:monthly candlestick

# Message Parameters

Name Type Description
id Long id,same as time
t Long Candlestick ID
a BigDecimal Trading volume in base currency
ct Long Number of trades
o BigDecimal Opening price in this period
c BigDecimal Closing price in this period
l BigDecimal Lowest price in this period
h BigDecimal Highest price in this period
v BigDecimal Trading volume in quote currency
s BigDecimal Trading Pair
p String Candlestick interval

# Subscription Example

{"method":"SUBSCRIBE","subject":"PUBLIC@CONTRACT_KLINE?BTC/USDT&1MIN"}

# Message Notification Example

{
	"d": {
		"p": "1min",
		"a": 3.24245000,
		"ct": 71,
		"c": 30683.73,
		"s": "BTC/USDT",
		"t": 1688552880,
		"v": 99526.18277590,
		"h": 30702.15,
		"id": 1688552880,
		"l": 30680.71,
		"o": 30700.00000000
	},
	"e": "MESSAGE",
	"s": "PUBLIC@CONTRACT_KLINE?BTC/USDT&1MIN"
}

# Trade Records

Title: PUBLIC@CONTRACT_TRADE?SYMBOL

Module Type Resource Isolation Type
Contract Market(CONTRACT_MARKET) Query(QUERY) Trading Pair(SYMBOL)

# Subscription Parameters

Name Description Example Value
SYMBOL Trading Pair BTC/USDT, etc. Please use the RestAPI contract trading pair configuration interface to retrieve all supported trading pairs

# Message Parameters

Name Type Description
s String Trading Pair
t Long Timestamp
a BigDecimal Trade Quantity
p BigDecimal Trade Price
d String Trading direction:BUY,SELL

# Subscription Example

{"method":"SUBSCRIBE","subject":"PUBLIC@CONTRACT_TRADE?BTC/USDT"}

# Message Notification Example

{
	"d": {
		"p": 30702.0,
		"a": 0.00359,
		"s": "BTC/USDT",
		"t": 1688552725746,
		"d": "BUY"
	},
	"e": "MESSAGE",
	"s": "PUBLIC@CONTRACT_TRADE?BTC/USDT"
}

# Depth

Title: PUBLIC@CONTRACT_DEPTH?SYMBOL&DEPTH

Module Type Resource Isolation Type
Contract Market(CONTRACT_MARKET) Query(QUERY) Trading Pair(SYMBOL)

# Subscription Parameters

Name Description Example Value
SYMBOL Trading Pair BTC/USDT, etc. Please use the RestAPI contract trading pair configuration interface to retrieve all supported trading pairs
DEPTH Depth Level DEPTH_5: 5 levels of depth; DEPTH_10:10 levels of depth;DEPTH_20: 20 levels of depth; DEPTH_50: 50 levels of depth

# Message Parameters

Name Type Description
s String Trading Pair
t Long Generation Time
bids Array Buy Orders
|a BigDecimal Quantity
|p BigDecimal Price
asks Array Sell Orders
|a BigDecimal Quantity
|p BigDecimal Price

# Subscription Example

{"method":"SUBSCRIBE","subject":"PUBLIC@CONTRACT_DEPTH?BTC/USDT&DEPTH_5"}

# Message Notification Example

{
    "d":{
        "s":"BTC/USDT",
        "t":1688725772858,
        "asks":[
            {
                "p":30233.86364,
                "a":0.5938
            },
            {
                "p":30233.97408,
                "a":0.59529
            },
            {
                "p":30234.22508,
                "a":0.88836
            },
            {
                "p":30238.974,
                "a":0.62001
            },
            {
                "p":30238.97408,
                "a":0.1206
            }
        ],
        "bids":[
            {
                "p":29992.9464,
                "a":0.53715
            },
            {
                "p":29988.35484,
                "a":0.44678
            },
            {
                "p":29987.79708,
                "a":0.13787
            },
            {
                "p":29987.39868,
                "a":0.58617
            },
            {
                "p":29985.41664,
                "a":0.24439
            }
        ]
    },
    "e":"MESSAGE",
    "s":"PUBLIC@CONTRACT_DEPTH?BTC/USDT&DEPTH_5"
}