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

# Orderbook

> Visibility into the orderbook

The orderbook is the live record of every standing buy and sell order on the market. Each row is
one order: its side, how many nodes, what hardware, which delivery window, and the price the
order would take.

Conceptually:

<img src="https://mintcdn.com/sfcompute/ekPsBVIJC-6oCHIH/preview/images/orderbook-concept.svg?fit=max&auto=format&n=ekPsBVIJC-6oCHIH&q=85&s=e5fb7e9545f56dc18286bccec6cc4623" alt="Orderbook with three example resting orders: a Buy for 8 H100s on Sep 1 9am to Sep 4 5pm at up to $1.42/node-hr, a Sell for 4 B200s on the same window at $1.38 minimum, and a Buy for 16 H200s on Oct 15 12am to Oct 22 12am at up to $0.95." width="100%" data-path="preview/images/orderbook-concept.svg" />

The trading engine matches buys against sells continuously. Orders that haven't matched yet are
visible to anyone querying the book. These endpoints expose that view.

Three endpoints under `/preview/v2/orderbook/`:

* [`/windows`](#windows) — enumerate active delivery windows in a time range.
* [`/quote`](#quote) — top of book (best bid + best ask) for one exact window.
* [`/depth`](#depth) — full depth of book at every price level for one exact window.

`/windows` is the entry point when you don't already know the exact window you want; the other
two price a specific window you've picked.

The hardware filter is `?requirements=key:value`, e.g. `accelerator_type:H100`,
`zone:richmond`, or `accelerator_type:H100,H200;zone:richmond` to combine. Each endpoint aggregates across every
cluster whose orders satisfy the filter.

All timestamps are Unix epoch seconds. Field names use the `_at` suffix.

## Windows

Enumerate every delivery window that currently has resting orders matching the requirements
filter, within a time range.

<img src="https://mintcdn.com/sfcompute/ekPsBVIJC-6oCHIH/preview/images/orderbook-windows.svg?fit=max&auto=format&n=ekPsBVIJC-6oCHIH&q=85&s=65441019b963211550401583ea90a8cf" alt="Three example delivery windows displayed as horizontal bars on a Sep 1 to Sep 29 time axis, each showing its bid and ask counts." width="100%" data-path="preview/images/orderbook-windows.svg" />

```json theme={null}
GET /preview/v2/orderbook/windows?requirements=zone:richmond&range_start_at=1777507200&range_end_at=1780099200

{
  "object": "list",
  "requirements": { "zone": ["richmond"] },
  "range_start_at": 1777507200,
  "range_end_at":   1780099200,
  "cursor": null,
  "has_more": false,
  "data": [
    {
      "start_at": 1777507200,
      "end_at":   1778112000,
      "duration_hours": 168,
      "total_bid_order_count": 3,
      "total_ask_order_count": 5,
      "total_bid_node_count": 12,
      "total_ask_node_count": 18,
      "best_bid": { "dollars_per_node_hour": "1.38", "node_count": 4 },
      "best_ask": { "dollars_per_node_hour": "1.42", "node_count": 2 }
    },
    {
      "start_at": 1777593600,
      "end_at":   1778198400,
      "duration_hours": 168,
      "total_bid_order_count": 0,
      "total_ask_order_count": 1,
      "total_bid_node_count": 0,
      "total_ask_node_count": 8,
      "best_ask": { "dollars_per_node_hour": "1.35", "node_count": 8 }
    }
  ]
}
```

A window is included when it has at least one resting order matching the filter and falls
entirely within the range. `best_bid` / `best_ask` are omitted when that side is empty. Sorted
ascending by start time, cursor-paginated. `limit` defaults to 50 and caps at 200; range capped
at 365 days.

## Quote

Top of book for one exact window. Best bid, best ask.

<img src="https://mintcdn.com/sfcompute/ekPsBVIJC-6oCHIH/preview/images/orderbook-quote.svg?fit=max&auto=format&n=ekPsBVIJC-6oCHIH&q=85&s=e62f15daba628c1c9ebd94640203deaf" alt="A vertical price ladder showing best ask of $1.42 with 2 nodes above best bid of $1.38 with 4 nodes, with a vertical bracket between them labeled spread $0.04." width="100%" data-path="preview/images/orderbook-quote.svg" />

```json theme={null}
GET /preview/v2/orderbook/quote?requirements=zone:richmond&start_at=1777507200&end_at=1778112000

{
  "requirements": { "zone": ["richmond"] },
  "start_at": 1777507200,
  "end_at":   1778112000,
  "requested_at": 1777426010,
  "best_bid": { "dollars_per_node_hour": "1.38", "node_count": 4 },
  "best_ask": { "dollars_per_node_hour": "1.42", "node_count": 2 }
}
```

Each side carries a `node_count`: the total nodes available at that rate, aggregated across
every resting order on that side.

## Depth

Depth of book aggregated by per-node-hour rate across every cluster matching the requirements
filter. Cluster identity is collapsed away.

<img src="https://mintcdn.com/sfcompute/ekPsBVIJC-6oCHIH/preview/images/orderbook-depth.svg?fit=max&auto=format&n=ekPsBVIJC-6oCHIH&q=85&s=cc8301034febb5168a515510fc38c101" alt="Level II ladder showing two ask price levels above the spread and three bid price levels below, with horizontal bars whose lengths encode the node count at each price." width="100%" data-path="preview/images/orderbook-depth.svg" />

```json theme={null}
GET /preview/v2/orderbook/depth?requirements=zone:richmond&start_at=1777507200&end_at=1778112000&depth=20

{
  "requirements": { "zone": ["richmond"] },
  "start_at": 1777507200,
  "end_at":   1778112000,
  "requested_at": 1777426010,
  "bids": [
    { "dollars_per_node_hour": "1.38", "node_count": 4 },
    { "dollars_per_node_hour": "1.37", "node_count": 6 }
  ],
  "asks": [
    { "dollars_per_node_hour": "1.42", "node_count": 2 },
    { "dollars_per_node_hour": "1.43", "node_count": 5 }
  ]
}
```

Bids descending by rate (best bid first); asks ascending. Orders at the same per-node-hour rate
collapse into one level. `depth` defaults to 20 and caps at 100 per side.
