# Order book

`GET /sigmafi/zc/markets/{market}/orderbook` · Lithos client API · SigmaFi ZC Standard

Source: https://lithosprotocol.org/docs/api/get-zc-orderbook

Asks (each carrying `borrowedByMe`) and bids around a maturity, `around` ± `band` blocks, or up to `to` blocks out. A bid and an ask are only compared at the same maturity: each ask carries the best bid at its own maturity (`bidAtBps`) and the gap to it (`spreadBps`, zero or less when it crosses), and the top-level `spreadBps` is the tightest such gap, with `spreadBlocks`, `spreadBidBps` and `spreadAskBps` saying where. It is null when no ask shares a maturity with a bid. Each bid is read at the anchor maturity (`anchorBlocks`: `to`, `around`, or a year), with `minBps` and `maxBps` across the range; `anchorBidBps` is the best bid at the anchor.

## Parameters

| Name | In | Type | Required | Description |

|---|---|---|---|---|

| `market` | path | string | yes | The market: `ERG` or `SigUSD`.  |

| `coverage` | query | integer · int64 | no | Asks with cover of at least this many bps; offers with a floor of at most this many. Default 15000.  |

| `kind` | query | string | no | `all`, `new` (borrow orders), `resale` (bond units and shares) or `shares`. Default `all`.  |

| `matchable` | query | boolean | no | Leave out paused, expired and flagged boxes. Default true.  |

| `grid` | query | boolean | no | Only maturities on the 21,600-block grid, and window orders that can pick one. Default false.  |

| `to` | query | integer · int64 | no | Most blocks to maturity shown.  |

| `around` | query | integer · int64 | no | Blocks to maturity the book centres on.  |

| `band` | query | integer · int64 | no | Blocks either side of `around`.  |

| `ifRevision` | query | integer · int64 | no | Answer 304 when the snapshot revision still equals this.  |

## Responses

### 200: The order book

`ZcObject`

- `at` (ZcAt): The snapshot a read or quote was taken from.
  - `height` (integer)
  - `blockId` (string)
  - `indexedHeight` (integer)
  - `revision` (integer · int64): Changes whenever anything a read returns changes, the mempool included.
  - `cut` (boolean): True when the book is at its size cap and left boxes out.
  - `mempool` (boolean): Whether unconfirmed boxes are laid over the confirmed book.

### 304: Nothing changed since `ifRevision`.

### 400: A malformed field, or terms the contracts refuse.

`ApiError`

- `error` (integer, required): Error code
- `reason` (string, required): Error message explaining the reason of the error
- `detail` (string, required): Detailed error description

### 429: Too many concurrent quotes, simulations, or heavy reads (`/curves`, `/orderbook`, `/fills`): at most 4 quotes/simulations and at most 4 heavy reads run or wait at once across all callers, and simulations are additionally limited to 5 in flight per caller, then 1 a second. Retry shortly.

`ApiError`

- `error` (integer, required): Error code
- `reason` (string, required): Error message explaining the reason of the error
- `detail` (string, required): Detailed error description

### 503: ZC tracking is off or not seeded, or the node, its index or the wallet did not answer. Nothing was sent.

`ApiError`

- `error` (integer, required): Error code
- `reason` (string, required): Error message explaining the reason of the error
- `detail` (string, required): Detailed error description

## Example request

```bash
curl -X GET "http://localhost:9000/sigmafi/zc/markets/{market}/orderbook"
```

## Example response

```json
{
  "at": {
    "height": 0,
    "blockId": "string",
    "indexedHeight": 0,
    "revision": 0,
    "cut": true,
    "mempool": true
  }
}
```
