v1

latestOpenAPI 3.1.02026-07-265385123.6 KB
Account

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.

get/api/v1/trade_history

Query parameters

accountstring required

User account address (user query alias is also accepted)

order_idstring

Filter by specific order ID (requires market to also be provided)

marketstring

Filter by market address

side'buy' | 'sell'

Order side filter: buy (long) or sell (short). For orders, maps to is_buy column. For trades/funding, maps to action IN ('OpenLong','CloseShort') (buy) or action IN ('CloseLong','OpenShort') (sell).

Filter by side

limitinteger

Page size

offsetinteger

Page offset

start_timestampinteger
end_timestampinteger
sort_key'timestamp'

Sort key for history endpoints

sort_dir'ASC' | 'DESC'

Response

Trade history retrieved successfully

total_countinteger nullable

The total number of items across all pages. Optional: history endpoints omit this field to avoid expensive COUNT(*) queries.

Example response

{
  "items": [
    {
      "account": "0x1234567890abcdef1234567890abcdef12345678",
      "action": "buy",
      "client_order_id": "client_order_abc",
      "counter_party_account": "0xfedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210",
      "market": "0xmarket123456789abcdef",
      "order_id": "12345",
      "price": 50000.25,
      "realized_funding_amount": -15.5,
      "size": 100.5,
      "source": "OrderFill",
      "trade_id": "3647276",
      "transaction_unix_ms": 1634567890000,
      "transaction_version": 3647276285
    }
  ]
}