Subscribing to the latest trades provides real-time data on the most recent trades performed on a specific contract.
{
"id": 1,
"jsonrpc": "2.0",
"method": "market.latest_trades.subscribe",
"params":{
"contract": "BTC-24MAR24"
}
}
Parameters:
contract
: ID or symbol of the contract.with_snapshot
: Whether to include the snapshot in the response. It may incur additional API credit spending.from_block_id
: Specifies the block from which to start sending the events. See more information about this in the Managing Data Integrity section.
Snapshots
The snapshot format is the same as v1/market/futures/{contract}/latest-trades endpoint response. Upon subscription, the snapshot of the latest trades is provided:
{
"jsonrpc": "2.0",
"method": "market.latest_trades.snapshot",
"params": {
"contract": "BTC-24MAR24",
"data": [
{
"last_price": "32500.00",
"quantity_contracts": "0.5",
"quantity_base": "16250.00",
"taker_side": "buy",
"time": "2024-05-07T10:30:00Z",
"tx_info": {
"tx_hash": "0xb427d9f5c2ecb41fd1e4741dbe52181091d530908c819b35d0401c6d835a2a22",
"event_id": "123456-2",
"block_timestamp": "2024-05-07T10:30:00Z"
}
}
]
}
}
Events
The events format is the same as v1/market/futures/{contract}/latest-trades endpoint response.
{
"jsonrpc": "2.0",
"method": "market.latest_trades.event",
"params": {
"contract": "BTC-24MAR24",
"data": {
"last_price": "32500.00",
"quantity_contracts": "0.5",
"quantity_base": "16250.00",
"taker_side": "buy",
"time": "2024-05-07T10:30:00Z",
"tx_info": {
"tx_hash": "0xb427d9f5c2ecb41fd1e4741dbe52181091d530908c819b35d0401c6d835a2a22",
"event_id": "123456-2",
"block_timestamp": "2024-05-07T10:30:00Z"
}
}
}
}