> ## 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 Fees Aggregation

> Returns fees per time period looking back from the present



## OpenAPI

````yaml /api-specs/public-rest-unified.json get /stats/api/v1/aggregations/fees
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/fees:
    get:
      tags:
        - Market
      summary: Get Fees Aggregation
      description: Returns fees per time period looking back from the present
      parameters:
        - name: group
          in: query
          schema:
            type: string
            enum:
              - symbol
              - feeSymbol
          required: true
          description: The grouping for the aggregation.
        - in: query
          name: symbol
          schema:
            type: string
          description: The symbol
          example: ETHP
        - in: query
          name: feeSymbol
          schema:
            type: string
            enum:
              - USDC
              - DDX
          description: The fee symbol
        - in: query
          name: aggregationPeriod
          schema:
            type: string
            enum:
              - week
              - day
              - hour
              - minute
            default: day
          description: The period for the aggregation.
        - in: query
          name: lookbackCount
          schema:
            type: integer
            default: 60
          description: The number of periods to look back from present.
        - in: query
          name: lookbackTimestamp
          schema:
            type: number
          description: >
            The timestamp of the when to begin the lookback from. Each lookback
            query will return nextLookbackTimestamp in the response, which can
            be passed as a query parameter here to get the next page of results.
      responses:
        '200':
          description: Fees aggregation data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeesAggregationAPISuccessResponse'
        '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:
    FeesAggregationAPISuccessResponse:
      type: object
      additionalProperties: false
      properties:
        nextLookbackTimestamp:
          type:
            - number
            - 'null'
          description: >-
            Time pointer for where the next lookback should begin. Pass this
            value as lookbackTimestamp to get the next page of data. Will also
            skip over gaps in the data to return the next non-null. aggregation
            period. When this value is null, it indicates there is no more data
            to fetch.
          examples:
            - 1673384400
            - 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 fees for a time period. Each entry contains a timestamp
              along with the total for each grouping.
            examples:
              - timestamp: 1671062400
                fees_DDX: '5.823239'
                fees_USDC: '7.8'
          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:
        - nextLookbackTimestamp
        - success
        - timestamp
        - value
      description: Successful response for the Fees aggregation 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

````