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

# Get DDX Aggregation

> Returns a rolling sum of DDX per time period grouped by the inflow and outflow types.



## OpenAPI

````yaml /api-specs/public-rest-unified.json get /stats/api/v1/aggregations/ddx
openapi: 3.1.0
info:
  title: DerivaDEX API Documentation
  version: '1.0'
  description: ''
servers:
  - url: https://testnet.derivadex.io
    description: DerivaDEX testnet
security: []
tags:
  - name: Venue-Wide Tables
    description: These APIs expose venue-wide public tables and reference data.
    x-source-api: Public REST API
  - name: System
    description: These APIs return system info.
    x-source-api: Public REST API
  - name: Trade
    description: These APIs provide data for a particular trader.
    x-source-api: Public REST API
  - name: Market
    description: These APIs return key high level metrics for markets.
    x-source-api: Public REST API
  - name: Trade
    description: These APIs provide data for a particular trader.
    x-source-api: Public Exchange REST API
  - name: Market
    description: These APIs return key high level metrics for markets.
    x-source-api: Public Exchange REST API
  - name: System
    description: These APIs return system info.
    x-source-api: Public Exchange REST API
paths:
  /stats/api/v1/aggregations/ddx:
    get:
      tags:
        - System
      summary: Get DDX Aggregation
      description: >-
        Returns a rolling sum of DDX per time period grouped by the inflow and
        outflow types.
      parameters:
        - in: query
          name: aggregationPeriod
          schema:
            type: string
            enum:
              - week
              - day
              - hour
              - minute
            default: day
          description: The period for the aggregation.
        - in: query
          name: startingValue
          schema:
            type: number
            default: 0
          description: >-
            The partial total of this aggregation, used for rolling aggregation
            paging.
        - in: query
          name: fromEpoch
          schema:
            type: integer
          description: The from epoch
          example: 0
        - in: query
          name: toEpoch
          schema:
            type: integer
          description: The to epoch
          example: 4000
      responses:
        '200':
          description: DDX aggregation data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DDXAggregationAPISuccessResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatsAPIErrorResponse'
        '500':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatsAPIErrorResponse'
components:
  schemas:
    DDXAggregationAPISuccessResponse:
      type: object
      additionalProperties: false
      properties:
        nextStartingValue:
          type:
            - string
            - 'null'
          description: >-
            The partial total for this aggregation, which can be passed as
            startingValue to get the next page for rolling aggregation type
            APIs.
          examples:
            - '34000'
            - null
        value:
          type: array
          items:
            type: object
            additionalProperties:
              type: string
            properties:
              timestamp:
                type: number
                description: The unix timestamp at the start of the aggregation period.
                examples:
                  - 1673308800
            required:
              - timestamp
            description: >-
              Aggregated DDX for a time period. Each entry contains a timestamp
              along with the grouped inflows and outflows as well as overall DDX
              in the system for that time period.
            examples:
              - timestamp: 1669680000
                ddx_deposits: '2000000'
                ddx_withdrawals: '0'
                ddx_trade-mining-rewards: '0'
                ddx_fees: '0'
                ddx_overall: '2000000'
          description: The value of the response
        success:
          type: boolean
          const: true
          description: Whether the request was successful
        timestamp:
          type: number
          description: The timestamp of the response
          examples:
            - 1673031089
      required:
        - nextStartingValue
        - success
        - timestamp
        - value
      description: Successful response for the DDX aggregaton API
    StatsAPIErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          const: false
        errorMsg:
          anyOf:
            - type: string
            - type: array
              items:
                type: object
                additionalProperties: false
      required:
        - success
      additionalProperties: false

````