> ## Documentation Index
> Fetch the complete documentation index at: https://docs.0xarchive.io/llms.txt
> Use this file to discover all available pages before exploring further.

# OrderBook Schema

> L2 order book snapshot. Includes required fields, field types, schema references, and generated JSON details from the 0xArchive OpenAPI contract.

Source OpenAPI: 0xArchive API 1.5.0; 140 paths; 119 component schemas.

L2 order book snapshot

## Required Fields

| Field       | Type             | Description                                          |
| ----------- | ---------------- | ---------------------------------------------------- |
| `asks`      | array\<object>   | Ask price levels (best ask first)                    |
| `bids`      | array\<object>   | Bid price levels (best bid first)                    |
| `coin`      | string           | Trading pair symbol (deprecated, use symbol instead) |
| `symbol`    | string           | Trading pair symbol                                  |
| `timestamp` | string:date-time | Snapshot timestamp (UTC)                             |

## JSON Schema

```json theme={"theme":"github-dark"}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "OrderBook",
  "description": "L2 order book snapshot",
  "type": "object",
  "required": [
    "asks",
    "bids",
    "coin",
    "symbol",
    "timestamp"
  ],
  "properties": {
    "asks": {
      "description": "Ask price levels (best ask first)",
      "type": "array",
      "items": {
        "description": "Single price level in the order book",
        "type": "object",
        "required": [
          "n",
          "px",
          "sz"
        ],
        "properties": {
          "n": {
            "description": "Number of orders at this level",
            "type": "integer",
            "example": 15
          },
          "px": {
            "description": "Price",
            "type": "string",
            "example": "42150.00"
          },
          "sz": {
            "description": "Total size at this price level",
            "type": "string",
            "example": "1.5"
          }
        }
      }
    },
    "bids": {
      "description": "Bid price levels (best bid first)",
      "type": "array",
      "items": {
        "description": "Single price level in the order book",
        "type": "object",
        "required": [
          "n",
          "px",
          "sz"
        ],
        "properties": {
          "n": {
            "description": "Number of orders at this level",
            "type": "integer",
            "example": 15
          },
          "px": {
            "description": "Price",
            "type": "string",
            "example": "42150.00"
          },
          "sz": {
            "description": "Total size at this price level",
            "type": "string",
            "example": "1.5"
          }
        }
      }
    },
    "coin": {
      "description": "Trading pair symbol (deprecated, use symbol instead)",
      "type": "string",
      "deprecated": true,
      "example": "BTC"
    },
    "mid_price": {
      "description": "Mid price (best bid + best ask) / 2",
      "type": "string",
      "example": "42150.50"
    },
    "spread": {
      "description": "Spread in absolute terms (best ask - best bid)",
      "type": "string",
      "example": "1.00"
    },
    "spread_bps": {
      "description": "Spread in basis points",
      "type": "string",
      "example": "2.37"
    },
    "symbol": {
      "description": "Trading pair symbol",
      "type": "string",
      "example": "BTC"
    },
    "timestamp": {
      "description": "Snapshot timestamp (UTC)",
      "type": "string",
      "format": "date-time",
      "example": "2025-01-21T10:30:45.123Z"
    }
  }
}
```

## Referenced By

Use this shared schema with the generated component index and route-specific endpoint pages during implementation.
