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

# Counts and daily volume

> Counts by market and by day, and the daily volume series. All time. Poll no more than once every 10 seconds.



## OpenAPI

````yaml /openapi/data-api.json get /v0/stats
openapi: 3.1.0
info:
  title: Rekt data API
  version: '0'
  summary: Read-only HTTP API for settled trades and ended positions.
  description: >-
    `https://data.rekt.trading` serves settled trades and ended positions. It is
    read-only and it needs no account. It sets no cookies and accepts no
    credentials. Responses carry `Access-Control-Allow-Origin: *`. Start at `GET
    /v0/health`.


    The program is the ground of truth. This API is a lagging mirror of it. Read
    live state from the chain through the SDK.


    Rules:


    - Every route answers `GET`, `HEAD` and `OPTIONS`. Any other method gets
    `405`.

    - A request URL is at most 2,048 characters. A longer one gets `414`.

    - Requests are rate-limited for each client address. `GET /v0/health` states
    the limit under `access`. A request over it gets `429` and a `Retry-After`
    header. Wait that long, then retry.

    - This API ignores a parameter that it does not know. A filter that this API
    refuses gets `400`.

    - Money amounts are decimal strings of base units of USDC (6 decimals).
    Addresses are 64 hex characters unless a field says base58. Transaction
    signatures are base58.

    - A response can hold fields that this description does not list. Ignore a
    field that you do not know.
servers:
  - url: https://data.rekt.trading
    description: The data API.
security: []
tags:
  - name: Health
    description: Freshness and limits.
  - name: Aggregates
    description: All-time totals and day series.
  - name: Trades
    description: Settled trades of the last 48 hours.
  - name: Positions
    description: Ended positions of the last 48 hours.
  - name: Minute
    description: Minute rounds of the last 48 hours.
paths:
  /v0/stats:
    get:
      tags:
        - Aggregates
      summary: Counts and daily volume
      description: >-
        Counts by market and by day, and the daily volume series. All time. Poll
        no more than once every 10 seconds.
      operationId: getStats
      responses:
        '200':
          description: Counts and daily volume.
          headers:
            Cache-Control:
              description: '`public, max-age=10, stale-while-revalidate=30`.'
              schema:
                type: string
            Warning:
              description: >-
                Present only when `asOf.stale` is true. It states that the
                archive is stale.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatsResponse'
        '414':
          $ref: '#/components/responses/UriTooLong'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  schemas:
    StatsResponse:
      type: object
      description: Counts by market and by day, and the daily volume series, for all time.
      properties:
        asOf:
          $ref: '#/components/schemas/AsOf'
        total:
          type: integer
          description: 'The number of settlements in the archive. Unit: settlements.'
        byMarket:
          type: object
          description: >-
            The number of settlements of each market. The key is the market
            account address as 64 hex characters. Unit: settlements.
          additionalProperties:
            type: integer
        byDay:
          type: object
          description: >-
            The number of settlements on each UTC day. The key is the day as
            `YYYY-MM-DD`. The API merges thin days: see `dayCells`. Unit:
            settlements.
          additionalProperties:
            type: integer
        volumeByDay:
          type: object
          description: >-
            The volume of each UTC day. The key is the day as `YYYY-MM-DD`. The
            cells are the same as in `byDay`.
          additionalProperties:
            $ref: '#/components/schemas/VolumeCell'
        dayCells:
          $ref: '#/components/schemas/DayCells'
        commitMode:
          type: object
          description: Counts of orders that no settlement records, for all time.
          properties:
            ordersFilled:
              type: integer
              description: 'The number of orders that the venue filled. Unit: orders.'
            opensVoided:
              type: integer
              description: 'The number of orders that the venue returned. Unit: orders.'
            voidedByReason:
              type: object
              description: >-
                The number of returned orders for each reason code. Unit:
                orders.
              additionalProperties:
                type: integer
      required:
        - asOf
        - total
        - byMarket
        - byDay
        - volumeByDay
        - dayCells
    AsOf:
      type: object
      description: How fresh the archive is at the time of this response.
      properties:
        generatedAt:
          type: string
          description: The time the server made this response, in UTC (ISO 8601).
          format: date-time
        archiveTailSlot:
          type:
            - integer
            - 'null'
          description: >-
            The slot of the newest transaction in the archive. Unit: slots. Null
            when the archive is empty.
        archiveTailAt:
          type:
            - string
            - 'null'
          description: >-
            The block time of the newest transaction in the archive, in UTC (ISO
            8601). Null when the archive is empty.
          format: date-time
        stale:
          type: boolean
          description: >-
            True when the archive has not moved for longer than its freshness
            limit. The server still sends a stale response, with a `Warning`
            header.
        staleReason:
          type:
            - string
            - 'null'
          description: Why the archive is stale, in words. Null when `stale` is false.
        entryFeeBasis:
          type: string
          description: >-
            How the entry fees in the rows were found. `observed` means each fee
            is the fee that the trade paid. Only the routes whose rows carry an
            entry fee send this field.
          enum:
            - observed
      required:
        - generatedAt
        - archiveTailSlot
        - archiveTailAt
        - stale
        - staleReason
    VolumeCell:
      type: object
      description: Volume for one period.
      properties:
        trades:
          type: integer
          description: 'The number of settlements. Unit: settlements.'
        stake:
          type: string
          pattern: ^[0-9]+$
          description: >-
            The sum of the stakes. Unit: base units of USDC (6 decimals), as a
            decimal string.
        notional:
          type: string
          pattern: ^[0-9]+$
          description: >-
            The sum of `stake × tier`. Unit: base units of USDC (6 decimals), as
            a decimal string.
        notionalUnknown:
          type: integer
          description: >-
            The number of settlements whose tier is not known. `notional` does
            not include them. Unit: settlements.
      required:
        - trades
        - stake
        - notional
        - notionalUnknown
    DayCells:
      type: object
      description: The rule for the day series.
      properties:
        minTrades:
          type: integer
          description: >-
            A UTC day with fewer settlements than this number is merged into the
            day after it. Unit: settlements.
        rule:
          type: string
          description: The merge rule, in words.
      required:
        - minTrades
        - rule
    Error:
      type: object
      description: A refused request.
      properties:
        error:
          type: string
          description: What is wrong, in words.
        retryAfterSeconds:
          type: integer
          description: 'On `429` only: wait this long, then retry. Unit: seconds.'
        routes:
          type: array
          items:
            type: string
          description: 'On `404` for an unknown route only: the routes that this API serves.'
      required:
        - error
  responses:
    UriTooLong:
      description: The request URL is longer than 2,048 characters. Shorten it.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TooManyRequests:
      description: >-
        Too many requests. Wait `Retry-After` seconds, then retry. `GET
        /v0/health` states the limit under `access`.
      headers:
        Retry-After:
          description: 'Wait this long before you retry. Unit: seconds.'
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ServerError:
      description: The server could not answer. Retry later.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.