Subscribing to the order book updates provides real-time data on the buying and selling interest levels at various price points within the market, essential for traders who need to gauge market depth and liquidity.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "market.order_book.subscribe",
  "params":{
    "contract": "BTC-24MAR24", 			
    "price_step": "0.001"  
  }
}

Parameters:

  • contract: ID or symbol of the contract.
  • price_step: Defines the minimum price increment (granularity) for the order book entries. This parameter is used to aggregate orders into specified price steps, which can simplify viewing market depth and liquidity at broader price intervals.
  • with_snapshot: Whether to include the snapshot in the response. It may incur additional API credit spending.

Snapshots

The snapshot format is the same as v1/market/futures/{contract}/order-book endpoint response. Upon subscription, the snapshot of the current order book is provided:

{
    "jsonrpc": "2.0",
    "method": "market.order_book.snapshot",
    "params": {
      	"contract": "BTC-24MAR24",
      	"price_step": "0.001",
        "data": {
          "bids": [
            {"price": "32500", "quantity_contracts": "4.2", "quantity_base": "136500.000000", "price_step": "0.001"},
            {"price": "32490", "quantity_contracts": "3.1", "quantity_base": "100719.000000", "price_step": "0.001"},
            {"price": "32480", "quantity_contracts": "5.5", "quantity_base": "178640.000000", "price_step": "0.001"}
          ],
          "asks": [
            {"price": "32510", "quantity_contracts": "2.2", "quantity_base": "71522.000000", "price_step": "0.001"},
            {"price": "32520", "quantity_contracts": "1.8", "quantity_base": "58536.000000", "price_step": "0.001"},
            {"price": "32530", "quantity_contracts": "4.0", "quantity_base": "130120.000000", "price_step": "0.001"}
          ],
          "block": {
            "block_id": 123456,                
            "block_timestamp": "2024-05-07T10:30:00Z" 
          }
        }
    }
}

Events

The event format is the same as v1/market/futures/{contract}/order-book endpoint response. These events are delivered to provide the latest bid and ask levels:

{
  "jsonrpc": "2.0",
  "method": "market.order_book.event",
  "params": {
    "contract": "BTC-24MAR24",
    "price_step": "0.001",
    "data": {
      "bids": [
        {"price": "32500", "quantity_contracts": "4.2", "quantity_base": "136500.000000", "price_step": "0.001"},
        {"price": "32490", "quantity_contracts": "3.1", "quantity_base": "100719.000000", "price_step": "0.001"},
        {"price": "32480", "quantity_contracts": "5.5", "quantity_base": "178640.000000", "price_step": "0.001"}
      ],
      "asks": [
        {"price": "32510", "quantity_contracts": "2.2", "quantity_base": "71522.000000", "price_step": "0.001"},
        {"price": "32520", "quantity_contracts": "1.8", "quantity_base": "58536.000000", "price_step": "0.001"},
        {"price": "32530", "quantity_contracts": "4.0", "quantity_base": "130120.000000", "price_step": "0.001"}
      ],
      "block": {
        "block_id": 123456,                
        "block_timestamp": "2024-05-07T10:30:00Z"           
      }	      
    }
}