# `CCXT.OrderBook`
[🔗](https://github.com/ZenHive/ccxt_client/blob/main/lib/ccxt/order_book.ex#L1)

Unified order book (market depth) data.

Contains sorted bid and ask price levels, each as `[price, amount]` pairs.
Bids are sorted highest-first, asks lowest-first.

## Fields

  * `symbol` - Unified symbol (e.g., "BTC/USDT")
  * `timestamp` - Exchange timestamp in milliseconds
  * `datetime` - ISO 8601 datetime string
  * `nonce` - Incremental update sequence number
  * `bids` - List of bid levels as `[price, amount]` pairs, highest first
  * `asks` - List of ask levels as `[price, amount]` pairs, lowest first
  * `info` - Raw exchange response

# `t`

```elixir
@type t() :: %CCXT.OrderBook{
  asks: [[number()]],
  bids: [[number()]],
  datetime: String.t() | nil,
  info: map() | nil,
  nonce: integer() | nil,
  symbol: String.t() | nil,
  timestamp: integer() | nil
}
```

# `best_ask`

```elixir
@spec best_ask(t()) :: number() | nil
```

Returns the best (lowest) ask price, or nil if empty/malformed.

# `best_bid`

```elixir
@spec best_bid(t()) :: number() | nil
```

Returns the best (highest) bid price, or nil if empty/malformed.

# `schema`

```elixir
@spec schema() :: map()
```

JSON Schema for the OrderBook unified type.

# `spread`

```elixir
@spec spread(t()) :: number() | nil
```

Returns the spread (best ask price - best bid price), or nil if either side is empty/malformed.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
