> ## 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. All four are computed from the same 30-day trade set, so the figures are internally consistent.

When the book pools depth with its fungibility class, the windows cover the whole eligible set.

Trades whose settlement failed permanently are excluded.

## 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. For value-weighted history use [Get Daily Stats](/endpoints/commodity-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/commodities/api/order-books/clx_ob_comm_001/stats" \
    -H "X-API-Key: trusset_your_key_here"
  ```

  ```typescript TypeScript theme={null}
  const res = await fetch(
    `https://api.trusset.org/orderbooks/commodities/api/order-books/${orderBookId}/stats`,
    { headers: { 'X-API-Key': 'trusset_your_key_here' } }
  );
  const { data } = await res.json();
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "1h": { "volume": "2000000", "trades": 1 },
      "24h": { "volume": "18000000", "trades": 9 },
      "7d": { "volume": "96000000", "trades": 44 },
      "30d": { "volume": "391000000", "trades": 173 }
    }
  }
  ```
</ResponseExample>

## Error Codes

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