---
title: "Orderbook"
url: https://docs.truemarkets.co/api/websocket/market-data/orderbook
description: "Full order-book depth snapshot for a subscribed orderbook.{venue}.{pair} topic."
---

Docs index: https://docs.truemarkets.co/llms.txt

# Orderbook

True Markets Market Data WebSocket sends these messages to you.

Address: `/v1/defi/market`

## Servers

- `wss://api.truemarkets.co` (Production, wss)
- `wss://api.uat.truemarkets.co` (Uat, wss)

## Messages

### orderbook

Full order-book depth snapshot for a subscribed pair.

Payload: `OrderbookPayload`

Example payload:

```json
{
  "type": "orderbook",
  "timestamp": 0,
  "topics": [
    "string"
  ],
  "data": {
    "venue": "string",
    "pair": "string",
    "coin": "string",
    "bids": [
      {
        "px": "string",
        "sz": "string",
        "n": 0
      }
    ],
    "asks": [
      {
        "px": "string",
        "sz": "string",
        "n": 0
      }
    ],
    "event_timestamp": "2019-08-24T14:15:22Z",
    "occurred_at": "2019-08-24T14:15:22Z"
  }
}
```

## Types

```ts
export type OrderbookMessage = OrderbookPayload;

export interface OrderbookPayload {
  type: "orderbook";
  timestamp: number;

  /** The concrete topic this message belongs to, e.g. `["orderbook.hyperliquid-spot.HYPE-USDC"]`. */
  topics: string[];
  data: OrderbookUpdate;
}

/** A full order-book depth snapshot for one pair; each update replaces the prior book. */
export interface OrderbookUpdate {
  /** Order-book venue. */
  venue?: string;

  /** Display pair. */
  pair?: string;

  /** Venue wire identifier for the pair. */
  coin?: string;

  /** Bid levels, best (highest price) first, truncated to the configured depth. */
  bids?: OrderbookLevel[];

  /** Ask levels, best (lowest price) first, truncated to the configured depth. */
  asks?: OrderbookLevel[];

  /** Venue-reported book time. */
  event_timestamp?: string;

  /** Time the producer emitted the event. */
  occurred_at?: string;
}

/** A single order-book price level. Values are decimal strings to preserve precision. */
export interface OrderbookLevel {
  /** Price at this level. */
  px?: string;

  /** Total size resting at this level. */
  sz?: string;

  /** Number of orders at this level. */
  n?: number;
}
```