Skip to content

Orderbook

OmniBit API provides high-performance orderbook snapshots for any subscribed market pair.

Endpoint Overview

Method Endpoint Description
GET /v1/orderbook/{baseTokenId}/{targetTokenId} Fetches an orderbook snapshot using token IDs.
GET /v1/orderbook/symbols/{baseSymbol}/{targetSymbol} Fetches an orderbook snapshot using symbols.

Retrieve Orderbook by Symbol

GET /v1/orderbook/symbols/{baseSymbol}/{targetSymbol}

Purpose:
Fetches an orderbook snapshot using ticker symbols. The user must have an active subscription to the specified pair.

Path Parameters:

Name Type Mandatory Description
baseSymbol string Yes Symbol of the base token.
targetSymbol string Yes Symbol of the target token.

Query Parameters (Optional):

Name Type Description
depth number Number of price levels (e.g., 15).
precision number Price rounding precision (e.g., 3 for three decimal places).
exchange string Exchange name or ALL to aggregate data from all exchanges.

Example Request

GET /v1/orderbook/symbols/BTC/USDT?depth=15&precision=3&exchange=ALL

Example Response

{
  "data": {
    "baseSymbol": "BTC",       // Symbol of the base token
    "targetSymbol": "USDT",    // Symbol of the target token
    "baseTokenId": 130,        // Token ID of the base token
    "targetTokenId": 5898,     // Token ID of the target token
    "precision": 3,            // Price rounding precision
    "depth": 15,               // Number of price levels
    "exchange": "ALL",         // Exchange name or ALL if aggregated
    "orders": [
      {
        "exchange": "OKX",     // Exchange name
        "orderSide": "BID",    // 'BID' or 'ASK'
        "orderSize": 3.43,     // Size at this order price
        "orderPrice": 139.37   // Price level
      },
      {
        "exchange": "BITFINEX",
        "orderSide": "ASK",
        "orderSize": 545.448,
        "orderPrice": 139.38
      }
      // ...
    ]
  },
  "success": true,
  "timestamp": 1741416142776,
  "requestId": "ab98fc14-ff33-4b7f-a0de-f0dde9556627",
  "message": "",
  "error": null
}

---

Retrieve Orderbook by Token ID

GET /v1/orderbook/{baseTokenId}/{targetTokenId}

Purpose:
Fetches an orderbook snapshot by using token IDs for the specified trading pair. The user must have an active subscription to this pair. Functionality is identical to the symbol-based endpoint, except baseTokenId and targetTokenId are used instead of symbols.

Path Parameters:

Name Type Mandatory Description
baseTokenId number Yes Token ID of the base token.
targetTokenId number Yes Token ID of the target token.

Query Parameters (Optional):

Name Type Description
depth number Number of price levels (e.g., 15).
precision number Price rounding precision (e.g., 3 for three decimal places).
exchange string Exchange name or ALL to aggregate data from all exchanges.

Example Request

GET /v1/orderbook/130/5898?depth=15&precision=3&exchange=ALL

Example Response

{
  "data": {
    "baseTokenId": 130,         // Token ID of the base token
    "targetTokenId": 5898,      // Token ID of the target token
    "precision": 3,             // Price rounding precision
    "depth": 15,                // Number of price levels
    "exchange": "ALL",          // Exchange name or ALL if aggregated
    "orders": [
      {
        "exchange": "OKX",      // Exchange name
        "orderSide": "BID",     // 'BID' or 'ASK'
        "orderSize": 3.43,      // Size at this order price
        "orderPrice": 139.37    // Price level
      },
      {
        "exchange": "BITFINEX",
        "orderSide": "ASK",
        "orderSize": 545.448,
        "orderPrice": 139.38
      }
      // ...
    ]
  },
  "success": true,
  "timestamp": 1741416142776,
  "requestId": "ab98fc14-ff33-4b7f-a0de-f0dde9556627",
  "message": "",
  "error": null
}

Orderbook Aggregation & Uniqueness

When exchange=ALL, orders from each exchange are included in a single response. However, price levels are never combined across different exchanges. Specifically:

  1. Price Rounding: Each order�s price is rounded to precision decimals.
  2. Merge per Exchange: Orders on the same exchange with the same rounded price are combined into a single order, summing their sizes.
  3. Separate per Exchange: If two different exchanges happen to share the same rounded price, they remain separate entries in the array.

Example: If OKX has orders at 139.231 and 139.232 (precision=2), they merge into one OKX order at 139.23. Meanwhile, Binance at 139.23 remains a separate order.


Subscription Requirement

  • SUBSCRIBED status is required for the requested pair.
  • Check your active subscriptions via GET /v1/subscriptions.