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

# Get user trade history

> Retrieve trade history for a specific user with optional filtering by market, order ID, side,
and timestamp range. Returns executed trades with price, size, PnL, and fee details.
Supports sorting by timestamp (default: descending) and pagination. Page size is capped at 200.



## OpenAPI

````yaml /api-reference/openapi.json get /api/v1/trade_history
openapi: 3.1.0
info:
  title: Decibel Trading API
  description: >-
    RESTful API for Decibel. Provides read-only endpoints for market data,
    trading operations, positions, and analytics.
  contact:
    name: Decibel Team
    url: https://decibel.trade/
  license:
    name: ''
  version: 1.0.0
servers:
  - url: https://api.mainnet.aptoslabs.com/decibel
    description: Mainnet
  - url: https://api.testnet.aptoslabs.com/decibel
    description: Testnet
security:
  - bearerAuth: []
tags:
  - name: Market Data
    description: Market information and real-time data endpoints
  - name: User
    description: User information and account management
  - name: Trades
    description: Trading operations and history
  - name: Positions
    description: User position management
  - name: Orders
    description: Order management and history
  - name: TWAP
    description: Time-weighted average price orders
  - name: Bulk Orders
    description: Bulk order management
  - name: Vaults
    description: Vault operations and management
  - name: Analytics
    description: Analytics and performance metrics
  - name: Predeposit Rewards
    description: Season 0 predeposit USDC rewards
  - name: Referrals
    description: Referral code management and tracking
paths:
  /api/v1/trade_history:
    get:
      tags:
        - Account
      summary: Get user trade history
      description: >-
        Retrieve trade history for a specific user with optional filtering by
        market, order ID, side,

        and timestamp range. Returns executed trades with price, size, PnL, and
        fee details.

        Supports sorting by timestamp (default: descending) and pagination. Page
        size is capped at 200.
      operationId: handle_account_trade_history
      parameters:
        - name: account
          in: query
          description: User account address
          required: true
          schema:
            type: string
          example: 0x123...
        - name: order_id
          in: query
          description: Filter by specific order ID (requires market to also be provided)
          required: false
          schema:
            type: string
          example: '12345'
        - name: market
          in: query
          description: Filter by market address
          required: false
          schema:
            type: string
          example: 0xmarket...
        - name: side
          in: query
          description: >-
            Filter by side: "buy" (OpenLong/CloseShort) or "sell"
            (CloseLong/OpenShort)
          required: false
          schema:
            $ref: 103a553b-2c52-4c5a-aba3-3ed022aa3126
        - name: pagination
          in: query
          description: Pagination parameters (limit and offset)
          required: true
          schema:
            type: object
            properties:
              limit:
                type: integer
                format: int32
                maximum: 1000
                minimum: 0
              offset:
                type: integer
                format: int32
                maximum: 10000
                minimum: 0
        - name: filter
          in: query
          description: Timestamp range filter
          required: true
          schema:
            $ref: 24e93dfc-f72d-4b88-9b3a-91162ef46f02
        - name: sorting
          in: query
          description: Sorting parameters
          required: true
          schema:
            $ref: 250c3ae3-9c34-48a6-b4be-a45159c4bc4d
      responses:
        '200':
          description: Trade history retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedResponse_TradeDto'
        '400':
          description: Invalid parameters (order_id requires market)
        '500':
          description: Database error
components:
  schemas:
    PaginatedResponse_TradeDto:
      type: object
      required:
        - items
        - total_count
      properties:
        items:
          type: array
          items:
            type: object
            required:
              - account
              - market
              - action
              - source
              - trade_id
              - size
              - price
              - is_profit
              - realized_pnl_amount
              - realized_funding_amount
              - is_rebate
              - fee_amount
              - order_id
              - client_order_id
              - transaction_unix_ms
              - transaction_version
            properties:
              account:
                type: string
                description: User's account address
                example: '0x1234567890abcdef1234567890abcdef12345678'
              action:
                type: string
                description: Trade action type (e.g., "buy", "sell", "liquidation")
                example: buy
              client_order_id:
                type: string
                description: Client-specified order ID
                example: client_order_abc
              fee_amount:
                type: number
                format: double
                description: Fee amount in raw units
              is_profit:
                type: boolean
                description: Whether trade was profitable
              is_rebate:
                type: boolean
                description: Whether trade received rebate
              market:
                type: string
                description: Market identifier address
                example: 0xmarket123456789abcdef
              order_id:
                type: string
                description: Order ID associated with trade
                example: '12345'
              price:
                type: number
                format: double
                description: Trade price
                example: 50000.25
              realized_funding_amount:
                type: number
                format: double
                description: >-
                  Realized funding amount in USDC

                  - Negative value: trader PAID funding (e.g., long position
                  with positive funding rate)

                  - Positive value: trader RECEIVED funding (e.g., short
                  position with positive funding rate)

                  - Zero: no funding accrued
                example: -15.5
              realized_pnl_amount:
                type: number
                format: double
                description: Realized PnL amount
              size:
                type: number
                format: double
                description: Trade size
                example: 100.5
              source:
                type: string
                description: >-
                  Trade source (e.g., "OrderFill", "MarginCall",
                  "BackStopLiquidation", "ADL", "MarketDelisted")
                example: OrderFill
              trade_id:
                type: string
                description: Trade ID
                example: '3647276'
              transaction_unix_ms:
                type: integer
                format: int64
                description: Transaction timestamp in milliseconds
                example: 1634567890000
              transaction_version:
                type: integer
                format: int64
                description: Transaction version
                example: 3647276285
                minimum: 0
          description: The items in the current page
        total_count:
          type: integer
          format: int32
          description: The total number of items across all pages
          minimum: 0
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer token from Geomi. See
        [Authentication](/api-reference/rest/authentication) for setup
        instructions.

````