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

# Get account trade statistics

> Returns the API-key owner's executed quote volume and marked net-inventory profit/loss for `1d`, `7d`, `30d`, `180d`, or `360d`, with the immediately preceding equal-duration comparison. The report ends at the last completed UTC hour and returns a fixed chart shape. Profit/loss excludes non-trading external contributions valued when committed; posted fees and rebates are already reflected in equity. Historical prices combine executions and Quidax midpoints, preferring executions on timestamp ties; marks must be at most 24 hours old, and unavailable inventory history or valuation returns `503`. Held inventory can change value in buckets without executions. An optional pair filter limits inventory to one current market and fails closed when other-base activity prevents attribution of shared quote inventory; otherwise recognized exchange bases are included and unlike quote cash currencies remain in separate summaries. Responses can be cached for 15 seconds, so use the returned period boundaries.



## OpenAPI

````yaml /openapi/openapi.json get /partner/exchange/trade-statistics
openapi: 3.1.0
info:
  title: Stabyl API
  description: >-
    REST API for approved Stabyl accounts to automate exchange, wallet, and
    non-production simulation workflows.
  contact:
    name: Stabyl Support
    email: support@stabyl.com
  license:
    name: Proprietary
  version: 1.0.0
servers:
  - url: https://api.stabyl.com/v1
    description: Production
  - url: https://api-staging.stabyl.com/v1
    description: Staging
security: []
tags:
  - name: Exchange
    description: Trading market data and order management for account automation.
  - name: Wallets
    description: >-
      Supported routes, deposit destinations, balances, transactions, and saved
      recipients.
  - name: Webhooks
    description: >-
      Outbound event delivery configuration and eventually consistent delivery
      history. Verify Standard Webhooks webhook-id, webhook-timestamp, and
      webhook-signature headers against the unchanged raw request body before
      parsing JSON.
  - name: Simulation
    description: Non-production endpoints for testing integration behavior.
paths:
  /partner/exchange/trade-statistics:
    get:
      tags:
        - Exchange
      summary: Get account trade statistics
      description: >-
        Returns the API-key owner's executed quote volume and marked
        net-inventory profit/loss for `1d`, `7d`, `30d`, `180d`, or `360d`, with
        the immediately preceding equal-duration comparison. The report ends at
        the last completed UTC hour and returns a fixed chart shape. Profit/loss
        excludes non-trading external contributions valued when committed;
        posted fees and rebates are already reflected in equity. Historical
        prices combine executions and Quidax midpoints, preferring executions on
        timestamp ties; marks must be at most 24 hours old, and unavailable
        inventory history or valuation returns `503`. Held inventory can change
        value in buckets without executions. An optional pair filter limits
        inventory to one current market and fails closed when other-base
        activity prevents attribution of shared quote inventory; otherwise
        recognized exchange bases are included and unlike quote cash currencies
        remain in separate summaries. Responses can be cached for 15 seconds, so
        use the returned period boundaries.
      operationId: get_partner_exchange_trade_statistics
      parameters:
        - name: interval
          in: query
          description: >-
            Required report duration. Supported values: `1d`, `7d`, `30d`,
            `180d`, `360d`.
          required: true
          schema:
            $ref: '#/components/schemas/TradeStatisticsInterval'
        - name: pair_id
          in: query
          description: >-
            Trading pair identifier returned by `GET /partner/exchange/markets`,
            for example `USD/NGN`.
          required: false
          schema:
            type:
              - string
              - 'null'
          example: USD/NGN
      responses:
        '200':
          description: Current and preceding-period account trade statistics
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/TradeStatisticsResponse'
                  status:
                    type: string
                    enum:
                      - success
              example:
                data:
                  as_of: '2026-05-24T12:00:00Z'
                  bucket_interval: 1d
                  current_period:
                    from: '2026-05-17T12:00:00Z'
                    to: '2026-05-24T12:00:00Z'
                  interval: 7d
                  pair_id: USD/NGN
                  previous_period:
                    from: '2026-05-10T12:00:00Z'
                    to: '2026-05-17T12:00:00Z'
                  summaries:
                    - buckets:
                        - from: '2026-05-17T12:00:00Z'
                          net_profit_loss: '1250.00'
                          to: '2026-05-18T12:00:00Z'
                          traded_volume: '82500.00'
                      net_profit_loss:
                        change_pct: 3.42
                        current: '25900.00'
                        previous: '25043.51'
                      quote_currency: NGN
                      traded_volume:
                        change_pct: 3.42
                        current: '525900.00'
                        previous: '508510.64'
                status: success
        '400':
          description: Unsupported interval or trading pair
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                        example: VALIDATION_FAILED
                      message:
                        type: string
                        example: invalid request parameters
                  status:
                    type: string
                    enum:
                      - error
              example:
                error:
                  code: VALIDATION_FAILED
                  message: invalid request parameters
                status: error
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                        example: UNAUTHORIZED
                      message:
                        type: string
                        example: missing X-Api-Key header
                  status:
                    type: string
                    enum:
                      - error
              example:
                error:
                  code: UNAUTHORIZED
                  message: missing X-Api-Key header
                status: error
        '403':
          description: API key lacks `trades:view`
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                        example: FORBIDDEN
                      message:
                        type: string
                        example: request is not allowed
                  status:
                    type: string
                    enum:
                      - error
              example:
                error:
                  code: FORBIDDEN
                  message: request is not allowed
                status: error
        '503':
          description: Required analytics projections are unavailable or invalid
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                        example: SERVICE_UNAVAILABLE
                      message:
                        type: string
                        example: service unavailable
                  status:
                    type: string
                    enum:
                      - error
              example:
                error:
                  code: SERVICE_UNAVAILABLE
                  message: service unavailable
                status: error
      security:
        - api_key: []
components:
  schemas:
    TradeStatisticsInterval:
      type: string
      description: Supported rolling period for authenticated trade statistics.
      enum:
        - 1d
        - 7d
        - 30d
        - 180d
        - 360d
    TradeStatisticsResponse:
      type: object
      description: >-
        Authenticated customer exchange report with an equal preceding
        comparison.
      required:
        - as_of
        - interval
        - current_period
        - previous_period
        - bucket_interval
        - summaries
      properties:
        as_of:
          type: string
          format: date-time
          description: Start of the current UTC hour and end of the last completed hour.
        bucket_interval:
          type: string
          description: Width of each chart bucket.
          example: 1d
        current_period:
          $ref: '#/components/schemas/TradeStatisticsPeriod'
          description: Current half-open period `[from, to)`.
        interval:
          type: string
          description: Requested rolling interval.
          example: 7d
        pair_id:
          type:
            - string
            - 'null'
          description: Canonical selected pair, or `null` when all pairs were requested.
        previous_period:
          $ref: '#/components/schemas/TradeStatisticsPeriod'
          description: Immediately preceding equal-duration half-open period `[from, to)`.
        summaries:
          type: array
          items:
            $ref: '#/components/schemas/TradeStatisticsSummary'
          description: >-
            One summary per quote currency, ordered by currency code. Values
            from

            unlike currencies are never added together.
    TradeStatisticsPeriod:
      type: object
      description: Exact half-open comparison period.
      required:
        - from
        - to
      properties:
        from:
          type: string
          format: date-time
          description: Inclusive period boundary.
        to:
          type: string
          format: date-time
          description: Exclusive period boundary.
    TradeStatisticsSummary:
      type: object
      description: Customer trade statistics for one quote currency.
      required:
        - quote_currency
        - traded_volume
        - net_profit_loss
        - buckets
      properties:
        buckets:
          type: array
          items:
            $ref: '#/components/schemas/TradeStatisticsBucketPoint'
          description: >-
            Current-period chart values on a continuous time axis. Volume is
            zero

            without executions; held inventory may still change in marked value.
        net_profit_loss:
          $ref: '#/components/schemas/ComparedTradeStatistic'
          description: >-
            Marked net-inventory profit/loss for the current and previous
            periods,

            excluding non-trading external contributions at committed-time
            value.
        quote_currency:
          type: string
          description: Currency of every monetary value in this summary.
          example: NGN
        traded_volume:
          $ref: '#/components/schemas/ComparedTradeStatistic'
          description: >-
            Total executed quote notional. Each fill is counted once even when
            the

            authenticated user is present on both sides.
    TradeStatisticsBucketPoint:
      type: object
      description: One zero-filled chart bucket inside the current period.
      required:
        - from
        - to
        - traded_volume
        - net_profit_loss
      properties:
        from:
          type: string
          format: date-time
          description: Inclusive bucket boundary.
        net_profit_loss:
          type: string
          description: >-
            Marked net-inventory change less non-trading external contributions,

            in major units of `quote_currency`. Posted fees are already
            included.
          example: '1250.00'
        to:
          type: string
          format: date-time
          description: Exclusive bucket boundary.
        traded_volume:
          type: string
          description: Executed quote notional in major units of `quote_currency`.
          example: '82500.00'
    ComparedTradeStatistic:
      type: object
      description: Current value, preceding-period value, and percentage change.
      required:
        - current
        - previous
      properties:
        change_pct:
          type:
            - number
            - 'null'
          format: double
          description: |-
            `(current - previous) / abs(previous) * 100`. It is `null` when the
            previous value is zero and the current value is non-zero.
          example: 3.42
        current:
          type: string
          description: Current-period amount in major units of `quote_currency`.
          example: '525900.00'
        previous:
          type: string
          description: Preceding-period amount in major units of `quote_currency`.
          example: '508510.64'
  securitySchemes:
    api_key:
      type: apiKey
      in: header
      name: X-Api-Key
      description: >-
        API credential. Withdrawal quote and submit operations additionally
        require the documented Ed25519 timestamp, nonce, and signature headers.
      x-default: sb_test_your_key

````