Skip to content

Get Orderbook

Retrieve order book depth (market depth) for a specific trading pair.

Endpoint

POST https://papi.synthetix.io/v1/info

Request

Request Format

{
  "params": {
    "action": "getOrderbook",
    "symbol": "BTC-USDT",
    "limit": 100
  }
}

Request Parameters

ParameterTypeRequiredDescription
params.actionstringYesMust be "getOrderbook"
params.symbolstringYesTrading pair symbol (e.g., "BTC-USDT")
params.limitintegerNoNumber of orders to return per side (default: 500)

Valid Limits

LimitDescription
5Top 5 orders per side
10Top 10 orders per side
20Top 20 orders per side
50Top 50 orders per side
100Top 100 orders per side
500Top 500 orders per side
1000Top 1000 orders per side

Response

Success Response

{
  "status": "ok",
  "response": {
    "bids": [
      ["45000.00", "1.5"],
      ["44999.50", "2.0"],
      ["44999.00", "0.8"]
    ],
    "asks": [
      ["45001.00", "1.2"],
      ["45001.50", "3.1"],
      ["45002.00", "0.9"]
    ]
  },
  "request_id": "5ccf215d37e3ae6d"
}

Depth Response Object

FieldTypeDescription
bidsarrayArray of bid orders [price, quantity]
asksarrayArray of ask orders [price, quantity]

Order Array Format

Each order in the bids and asks arrays is represented as:

["price", "quantity"]

Where:

  • price (string): Order price
  • quantity (string): Order quantity

Error Response

{
  "status": "error",
  "error": {
    "message": "Invalid limit parameter",
    "code": "VALIDATION_ERROR"
  },
  "request_id": "5ccf215d37e3ae6d",
  "timestamp": "2025-01-01T00:00:00Z"
}

Code Examples

Get Top 100 Orders

{
  "params": {
    "action": "getOrderbook",
    "symbol": "BTC-USDT",
    "limit": 100
  }
}

Get Top 20 Orders

{
  "params": {
    "action": "getOrderbook",
    "symbol": "ETH-USDT",
    "limit": 20
  }
}

Market Depth Information

  • Real-time Data: Live order book snapshot
  • Bid/Ask Orders: Separate arrays for buy and sell orders
  • Price Priority: Orders sorted by best price first
  • Configurable Depth: Choose from 5 to 1000 orders per side
  • Sequence Numbers: Track order book updates for consistency

Use Cases

  • Market Analysis: Understand liquidity and market depth
  • Trading Decisions: Analyze order book pressure
  • Price Discovery: See where orders are concentrated
  • Liquidity Assessment: Evaluate market depth for large orders
  • Real-time Monitoring: Track order book changes

Validation Rules

  • symbol must be a valid trading pair
  • limit must be one of the valid limit values
  • No authentication required
  • Real-time data from matching engine

Error Handling

Common error scenarios:

ErrorDescription
Invalid signatureEIP-712 signature validation failed
Invalid market symbolMarket symbol not recognized
Nonce already usedNonce must be greater than previous value
Rate limit exceededToo many requests in time window
Request expiredexpiresAfter timestamp has passed
ErrorDescription
Symbol requiredMissing trading pair symbol
Invalid limitLimit not in valid range
TimeoutRequest to matching service timed out
Market data unavailableFailed to retrieve order book data

Rate Limiting

  • Default: 1000 requests per minute per IP
  • Burst: Up to 100 requests per second
  • Real-time Data: High-frequency access supported

Data Format Notes

  • Price Precision: Prices use market-specific decimal precision
  • Quantity Precision: Quantities use market-specific decimal precision
  • Order Sorting: Bids sorted descending (highest first), asks sorted ascending (lowest first)
  • Snapshot Consistency: All data from the same timestamp

Related Endpoints