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

# Query anonymized public trade history

> Returns paginated, anonymized settled trades with optional filters: `trade_id` (a UUID, which overrides all other filters), `instrument_name`, `instrument_type` (erc20/option/perp), `currency`, `subaccount_id`, `tx_status` (a batch-status name, default Settled), and `from_timestamp`/`to_timestamp`. Each trade is enriched with its settlement status and transaction hash. Public endpoint.



## OpenAPI

````yaml /openapi.json post /public/get_trade_history
openapi: 3.1.0
info:
  title: Derive v3 API
  version: 0.2.0
  description: JSON-RPC 2.0 methods, served over WebSocket and HTTP POST.
servers:
  - url: https://api.derive.xyz/v3
    description: Production (HTTP POST base)
  - url: https://testnet.api.derive.xyz/v3
    description: Testnet (HTTP POST base)
security: []
tags:
  - name: Subaccounts
    description: >-
      List, inspect, and label subaccounts, portfolios, positions, and
      collateral.
  - name: Session Keys
    description: Register, edit, and list delegated signing keys.
  - name: Account
    description: Wallet-level account information and settings.
  - name: Orderbook
    description: Place, replace, cancel, and query orders, trigger orders, and algos.
  - name: RFQ
    description: 'Request-for-quote: send RFQs, quote, and execute block trades.'
  - name: Vault Shareholders
    description: >-
      Deposit into and withdraw from vaults, and track shares, requests, and
      performance.
  - name: Vault Curators
    description: >-
      Create and operate curated vaults: settle deposit and withdrawal requests,
      and manage vault metadata.
  - name: History
    description: >-
      Per-account historical records: orders, trades, transfers, and
      settlements.
  - name: Market Maker Protection
    description: Configure, read, and reset market-maker protection.
  - name: Transfers & Withdrawals
    description: Move collateral between subaccounts, to other wallets, and on-chain.
  - name: System
    description: Rate limits and transaction lookups.
  - name: Market Data
    description: Instruments, currencies, tickers, and market-wide feeds.
  - name: Referrals
    description: Referral codes and program performance.
  - name: Other
    description: Uncategorized.
paths:
  /public/get_trade_history:
    post:
      tags:
        - Market Data
      summary: Query anonymized public trade history
      description: >-
        Returns paginated, anonymized settled trades with optional filters:
        `trade_id` (a UUID, which overrides all other filters),
        `instrument_name`, `instrument_type` (erc20/option/perp), `currency`,
        `subaccount_id`, `tx_status` (a batch-status name, default Settled), and
        `from_timestamp`/`to_timestamp`. Each trade is enriched with its
        settlement status and transaction hash. Public endpoint.
      operationId: public_get_trade_history
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetPublicTradeHistoryRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicTradesResult'
        default:
          description: JSON-RPC error (see Error Codes)
components:
  schemas:
    GetPublicTradeHistoryRequest:
      type: object
      properties:
        currency:
          default: null
          type:
            - string
            - 'null'
        from_timestamp:
          default: null
          type:
            - integer
            - 'null'
          format: int64
        instrument_name:
          default: null
          type:
            - string
            - 'null'
        instrument_type:
          default: null
          type:
            - string
            - 'null'
        page:
          default: null
          type:
            - integer
            - 'null'
          format: uint32
          minimum: 0
        page_size:
          default: null
          type:
            - integer
            - 'null'
          format: uint32
          minimum: 0
        subaccount_id:
          default: null
          type:
            - integer
            - 'null'
          format: int64
        to_timestamp:
          default: null
          type:
            - integer
            - 'null'
          format: int64
        trade_id:
          default: null
          type:
            - string
            - 'null'
        tx_status:
          default: null
          type:
            - string
            - 'null'
    PublicTradesResult:
      type: object
      required:
        - pagination
        - trades
      properties:
        pagination:
          $ref: '#/components/schemas/Pagination'
        trades:
          type: array
          items:
            $ref: '#/components/schemas/SettledTrade'
    Pagination:
      description: Response envelope for paginated RPCs.
      type: object
      required:
        - count
        - num_pages
      properties:
        count:
          type: integer
          format: uint64
          minimum: 0
        num_pages:
          type: integer
          format: uint64
          minimum: 0
    SettledTrade:
      description: >-
        A settled trade returned by `public/get_trade_history`. Anonymized: no
        `order_id` or `label`. `wallet` is included since settled trades are
        visible on-chain.
      type: object
      required:
        - direction
        - expected_rebate
        - extra_fee
        - index_price
        - instrument_name
        - liquidity_role
        - mark_price
        - quote_id
        - realized_pnl
        - realized_pnl_excl_fees
        - rfq_id
        - subaccount_id
        - timestamp
        - trade_amount
        - trade_fee
        - trade_id
        - trade_price
        - tx_hash
        - wallet
      properties:
        direction:
          $ref: '#/components/schemas/Direction'
        expected_rebate:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        extra_fee:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        index_price:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        instrument_name:
          type: string
        liquidity_role:
          $ref: '#/components/schemas/LiquidityRole'
        mark_price:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        quote_id:
          description: Optional UUID v4 string
          type:
            - string
            - 'null'
          format: uuid
        realized_pnl:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        realized_pnl_excl_fees:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        rfq_id:
          description: Optional UUID v4 string
          type:
            - string
            - 'null'
          format: uuid
        subaccount_id:
          type: integer
          format: int64
        timestamp:
          type: integer
          format: int64
        trade_amount:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        trade_fee:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        trade_id:
          type: string
        trade_price:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        tx_hash:
          type: string
        tx_status:
          anyOf:
            - $ref: '#/components/schemas/BatchStatus'
            - type: 'null'
        wallet:
          type: string
    Direction:
      type: string
      enum:
        - buy
        - sell
    LiquidityRole:
      type: string
      enum:
        - maker
        - taker
    BatchStatus:
      description: >-
        Batch lifecycle status — the single source of lifecycle truth for every
        operation in the batch (individual ops carry no status of their own).
        Each stage has a healthy variant and a corresponding `...Error` variant
        meaning that stage failed. Serialized as the variant name (string) in
        API responses.
      type: string
      enum:
        - Batching
        - Executing
        - Proving
        - Settling
        - Settled
        - BatchingError
        - ExecutingError
        - ProvingError
        - SettlingError
        - SettledError

````

## Related topics

- [Migration skill for your coding agent](/migrating/breaking-changes.md)
- [Trade](/vaults/trade.md)
- [Get trade OHLCV candles for an instrument](/api-reference/market-data/get-trade-ohlcv-candles-for-an-instrument.md)
