---
title: "public/get_trade_history"
method: POST
path: "/public/get_trade_history"
tags: ["Market Data"]
---

# public/get_trade_history

`POST /public/get_trade_history`

## Request

- Base URL: `https://api.derive.xyz/v3`
- URL: `https://api.derive.xyz/v3/public/get_trade_history`
- Auth: none declared

Returns paginated, anonymized trades with optional filters: `trade_id` (a UUID, which overrides all other filters), `instrument_name`, `instrument_type` (erc20/option/perp), `currency`, `subaccount_id`, `batch_status` (a batch-status name; unset returns trades in every batch state), and `from_timestamp`/`to_timestamp`. Without `trade_id`, `subaccount_id` or `instrument_name`, or whenever `batch_status` is set, the window is limited to the 30 days ending at `to_timestamp` (or now). Each trade is enriched with its settlement status and transaction hash. A block trade does not show who traded it: `wallet` is the zero address, and `subaccount_id`, `realized_pnl` and `realized_pnl_excl_fees` are 0. The `subaccount_id` filter does not return block trades. Public endpoint.

## Request body

- GetPublicTradeHistoryRequest
  - `batch_status` 'Batching' | 'Executing' | 'Da' | 'Proving' | 'Settling' | 'Settled' | 'BatchingError' | 'ExecutingError' | 'DaError' | 'ProvingError' | 'SettlingError' | 'SettledError', nullable: 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.
  - `currency` string, nullable
  - `from_timestamp` integer, nullable
  - `instrument_name` string, nullable
  - `instrument_type` 'option' | 'perp' | 'erc20', nullable: Asset type of the instrument: `"option"`, `"perp"`, or `"erc20"`.
  - `page` integer, nullable
  - `page_size` integer, nullable
  - `subaccount_id` integer, nullable
  - `to_timestamp` integer, nullable
  - `trade_id` string, nullable

## Response `200`

Success

- PublicTradesResult
  - `pagination` Pagination, required: Response envelope for paginated RPCs.
    - `count` integer, required
    - `num_pages` integer, required
  - `trades` SettledTrade[], required
    - `batch_status` 'Batching' | 'Executing' | 'Da' | 'Proving' | 'Settling' | 'Settled' | 'BatchingError' | 'ExecutingError' | 'DaError' | 'ProvingError' | 'SettlingError' | 'SettledError', nullable: 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.
    - `block_trade_id` string, uuid, nullable, required: Optional UUID v4 string
    - `direction` 'buy' | 'sell', required
    - `expected_rebate` string, decimal, required: Decimal string of the human value (e.g. `"1.5"`), up to 12 fractional digits; a string or JSON number is accepted
    - `extra_fee` string, decimal, required: Decimal string of the human value (e.g. `"1.5"`), up to 12 fractional digits; a string or JSON number is accepted
    - `index_price` string, decimal, required: Decimal string of the human value (e.g. `"1.5"`), up to 12 fractional digits; a string or JSON number is accepted
    - `instrument_name` string, required
    - `liquidity_role` 'maker' | 'taker', required
    - `mark_price` string, decimal, required: Decimal string of the human value (e.g. `"1.5"`), up to 12 fractional digits; a string or JSON number is accepted
    - `quote_id` string, uuid, nullable, required: Optional UUID v4 string
    - `realized_pnl` string, decimal, required: Decimal string of the human value (e.g. `"1.5"`), up to 12 fractional digits; a string or JSON number is accepted
    - `realized_pnl_excl_fees` string, decimal, required: Decimal string of the human value (e.g. `"1.5"`), up to 12 fractional digits; a string or JSON number is accepted
    - `rfq_id` string, uuid, nullable, required: Optional UUID v4 string
    - `subaccount_id` integer, required
    - `timestamp` integer, required
    - `trade_amount` string, decimal, required: Decimal string of the human value (e.g. `"1.5"`), up to 12 fractional digits; a string or JSON number is accepted
    - `trade_fee` string, decimal, required: Decimal string of the human value (e.g. `"1.5"`), up to 12 fractional digits; a string or JSON number is accepted
    - `trade_id` string, required
    - `trade_price` string, decimal, required: Decimal string of the human value (e.g. `"1.5"`), up to 12 fractional digits; a string or JSON number is accepted
    - `tx_hash` string, required
    - `wallet` string, required

## Other responses

- `default`: JSON-RPC error (see Error Codes)

## Changes

- **2026-11-12** `1daf38a69a7a`: 1 info
  - added the required property `trades/items/block_trade_id` to the response with the `200` status
- **2026-10-20** `0c500202be49`: 1 info
  - added the media type `application/json` for the response with the status `default`

[Operation history](https://skmtc.dev/lyra/apis/derive-v3-api/changes/public/get_trade_history/post.md)

---

[API](https://skmtc.dev/lyra/apis/derive-v3-api.md) - [All operations](https://skmtc.dev/lyra/apis/derive-v3-api/llms.txt) - [OpenAPI document](https://skmtc.dev/lyra/apis/derive-v3-api/revisions/415f8a73b10c?raw)
