> ## 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 Daily Stats

> Daily OHLC and volume history for every book on one security

Returns a day-by-day series for a security token rather than a single book. Every non-closed external securities book your instance holds on that token contributes, and any pooled peers of those books contribute too, so the series describes the instrument as your venue sees it.

The response always carries one entry per calendar day in the range, in UTC, including days with no activity, so the series is directly plottable.

## Path Parameters

<ParamField path="tokenAddress" type="string" required>
  Security token contract. Matched case-insensitively.
</ParamField>

## Query Parameters

<ParamField query="range" type="string" default="1M">
  Window length: `1W`, `1M`, `3M`, `6M` or `1Y`. Anything else returns `INVALID_PARAM`.
</ParamField>

## Response Fields

<ResponseField name="data" type="object">
  <Expandable>
    <ResponseField name="hasOrderbook" type="boolean">
      False when your instance holds no non-closed external securities book on this token. `orderbooks` and `stats` are then empty and `totals` are zero.
    </ResponseField>

    <ResponseField name="orderbooks" type="array">
      The books that contributed, oldest first, each with `id`, `name`, `symbol`, `settlementMode`, `status`, `tokenType` and `quoteTokenAddress`.
    </ResponseField>

    <ResponseField name="stats" type="array">
      One entry per day, oldest first.

      <Expandable>
        <ResponseField name="date" type="string">UTC day, `YYYY-MM-DD`.</ResponseField>
        <ResponseField name="orderCount" type="integer">Orders submitted that day.</ResponseField>
        <ResponseField name="tradeCount" type="integer">Trades executed that day.</ResponseField>
        <ResponseField name="volumeBase" type="number">Base volume as a decimal number.</ResponseField>
        <ResponseField name="volumeQuote" type="number">Quote notional as a decimal number.</ResponseField>
        <ResponseField name="priceHigh" type="number">Highest trade price that day, or `null`.</ResponseField>
        <ResponseField name="priceLow" type="number">Lowest trade price, or `null`.</ResponseField>
        <ResponseField name="priceOpen" type="number">First trade price, or `null`.</ResponseField>
        <ResponseField name="priceClose" type="number">Last trade price, or `null`.</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="range" type="string">The range applied.</ResponseField>

    <ResponseField name="truncated" type="boolean">
      True when the underlying scan hit its 50,000-row ceiling, meaning the series understates a very busy instrument.
    </ResponseField>

    <ResponseField name="totals" type="object">
      `orderCount`, `tradeCount`, `volumeBase` and `volumeQuote` across the range.
    </ResponseField>
  </Expandable>
</ResponseField>

<Note>
  Prices and volumes here are decimal numbers, not order book unit strings. Everywhere else on this surface amounts are integer strings; this endpoint is the display series and is scaled for charting.
</Note>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.trusset.org/orderbooks/external-securities/api/order-books/by-token/0x51f2b9d0e77c4a1b83ce6d4a9271e5f3a0c8b912/daily-stats?range=3M" \
    -H "X-API-Key: trusset_your_key_here"
  ```

  ```typescript TypeScript theme={null}
  const res = await fetch(
    `https://api.trusset.org/orderbooks/external-securities/api/order-books/by-token/${tokenAddress}/daily-stats?range=3M`,
    { headers: { 'X-API-Key': 'trusset_your_key_here' } }
  );
  const { data } = await res.json();
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "hasOrderbook": true,
      "orderbooks": [
        {
          "id": "clx_ob_extsec_001",
          "name": "Helvetia Growth Fund",
          "symbol": "HELG",
          "settlementMode": "ON_CHAIN",
          "status": "ACTIVE",
          "tokenType": "EXTERNAL_SECURITY",
          "quoteTokenAddress": "0x98ad0ca091552e23c564b41c74282e5343d03e8a"
        }
      ],
      "stats": [
        {
          "date": "2025-06-14",
          "orderCount": 4,
          "tradeCount": 2,
          "volumeBase": 20,
          "volumeQuote": 2084,
          "priceHigh": 104.8,
          "priceLow": 103.9,
          "priceOpen": 103.9,
          "priceClose": 104.2
        }
      ],
      "range": "3M",
      "truncated": false,
      "totals": {
        "orderCount": 122,
        "tradeCount": 61,
        "volumeBase": 884,
        "volumeQuote": 92086.4
      }
    }
  }
  ```
</ResponseExample>

## Error Codes

| Code                  | HTTP  | Cause                                               |
| --------------------- | ----- | --------------------------------------------------- |
| `INVALID_PARAM`       | `400` | `range` is not one of the five accepted values      |
| `VALIDATION_ERROR`    | `400` | `tokenAddress` is not a valid address               |
| `INSTANCE_REQUIRED`   | `400` | The request carried no resolvable instance          |
| `SERVICE_NOT_ENABLED` | `403` | The Trading service is not enabled on this instance |
