Market Transaction Subscription
Info
- The push delay of this method is about:200ms
Market Transaction Subscription
- Method:
deals.subscribe
- Parameters:
Parameter Name | Required | Type | Notes |
---|---|---|---|
market_list | true | []string | List of market names. Empty list to subscribe to all markets. |
- Subscription example:
// Subscribe to a singular market
{
"method": "deals.subscribe",
"params": {"market_list": ["BTCUSDT"]},
"id": 1
}
// Subscribe to multiple markets
{
"method": "deals.subscribe",
"params": {"market_list": ["BTCUSDT", "ETHUSDT"]},
"id": 1
}
// Subscribe to all markets
{
"method": "deals.subscribe",
"params": {"market_list": []},
"id": 1
}
Latest Market Transaction Push
- Method:
deals.update
- Parameters:
Parameter Name | Type | Notes |
---|---|---|
market | string | Market name |
deal_list | array | List of latest transactions |
deal_list[n].deal_id | int | Txid |
deal_list[n].created_at | int | Transaction timestamp (milliseconds) |
deal_list[n].side | string | Taker side, "buy" or "sell" |
deal_list[n].price | string | Filled price |
deal_list[n].amount | string | Executed Amount |
- Example:
// market's deal
{
"method": "deals.update",
"data": {
"market": "BTCUSDT",
"deal_list": [
{
"deal_id": 3514376759,
"created_at": 1689152421692,
"side": "buy",
"price": "30718.42",
"amount": "0.00000325"
},
{
"deal_id": 3514376758,
"created_at": 1689152421692,
"side": "buy",
"price": "30718.42",
"amount": "0.00015729"
},
{
"deal_id": 3514376757,
"created_at": 1689152421692,
"side": "sell",
"price": "30718.42",
"amount": "0.00154936"
}
]
},
"id": null
}
Cancel Latest Market Transaction Subscription
- Method:
deals.unsubscribe
- Parameters:
Parameter Name | Required | Type | Notes |
---|---|---|---|
market_list | true | []string | List of market names. Empty list to unsubscribe to all markets. |
- Example:
// Cancel a singular subscription
{
"method": "deals.unsubscribe",
"params": {"market_list": ["BTCUSDT"]},
"id": 1
}
// Cancel multiple subscriptions
{
"method": "deals.unsubscribe",
"params": {"market_list": ["BTCUSDT", "ETHUSDT"]},
"id": 1
}
// Cancel all subscriptions
{
"method": "deals.unsubscribe",
"params": {"market_list": []},
"id": 1
}