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

# Get Order Book Stats

> Rolling volume and trade counts over four windows

Returns base volume and trade count for one book over four rolling windows ending now: one hour, 24 hours, 7 days and 30 days. Each window is computed from the same 30-day trade set, so the figures are internally consistent.

When the book pools depth with peers, the windows cover the whole eligible set, matching what [Get Order Book Snapshot](/endpoints/stock-trading/get-order-book-snapshot) reports.

Trades whose settlement failed permanently are excluded. A refused settlement moved nothing and was reversed, so counting it would misstate activity.

## Path Parameters

<ParamField path="orderBookId" type="string" required>Order book ID.</ParamField>

## Response Fields

<ResponseField name="data" type="object">
  <Expandable>
    <ResponseField name="1h" type="object">
      <Expandable>
        <ResponseField name="volume" type="string">Base volume in order book units.</ResponseField>
        <ResponseField name="trades" type="integer">Trade count.</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="24h" type="object">Same shape, over 24 hours.</ResponseField>
    <ResponseField name="7d" type="object">Same shape, over 7 days.</ResponseField>
    <ResponseField name="30d" type="object">Same shape, over 30 days.</ResponseField>
  </Expandable>
</ResponseField>

<Note>
  Volume is base quantity only. There is no notional figure here; for value-weighted history use [Get Daily Stats](/endpoints/stock-trading/get-daily-stats), which reports both base and quote volume per day.
</Note>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.trusset.org/orderbooks/stocks/api/order-books/clx_ob_stock_002/stats" \
    -H "X-API-Key: trusset_your_key_here"
  ```

  ```typescript TypeScript theme={null}
  const res = await fetch(
    `https://api.trusset.org/orderbooks/stocks/api/order-books/${orderBookId}/stats`,
    { headers: { 'X-API-Key': 'trusset_your_key_here' } }
  );
  const { data } = await res.json();
  console.log('24h volume', data['24h'].volume, 'in', data['24h'].trades, 'trades');
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "1h": { "volume": "3000000", "trades": 2 },
      "24h": { "volume": "31000000", "trades": 12 },
      "7d": { "volume": "184000000", "trades": 63 },
      "30d": { "volume": "702000000", "trades": 241 }
    }
  }
  ```
</ResponseExample>

## Error Codes

| Code                   | HTTP  | Cause                                                  |
| ---------------------- | ----- | ------------------------------------------------------ |
| `INVALID_PARAM`        | `400` | `orderBookId` is missing or longer than 100 characters |
| `ORDER_BOOK_NOT_FOUND` | `404` | No such stock book on this instance, and not imported  |
| `SERVICE_NOT_ENABLED`  | `403` | The Trading service is not enabled on this instance    |
