On this page

# Get trade history

    GET /api/v1/positions/history

####
Query Parameters

Field
Type
Need
Description
Example

`"account"`

string

required

User's wallet address

`42trU9A5...`

`"symbol"`

string

optional

Market symbol to filter by

`BTC`

`"start_time"`

integer

optional

Start time in milliseconds

`1625097600000`

`"end_time"`

integer

optional

End time in milliseconds

`1625184000000`

`"limit"`

integer

optional

Maximum number of records to return, defaults to system defined limit

`100`

`"offset"`

integer

optional

Number of records to skip

`0`

    /api/v1/positions/history?account=42trU9A5...&start_time=1625097600000&end_time=1625184000000&granularity_in_minutes=60&limit=100"

####
Response

- Status 200: Successfully retrieved portfolio position history

      [
        {
          "history_id": 1370,
          "order_id": 42347,
          "client_order_id": null,
          "symbol": "BTC",
          "amount": "0.00259000",
          "price": "106093.000000",
          "entry_price": "104004.521434",
          "fee": "0.192347",
          "pnl": "5.216813",
          "event_type": "fulfill_taker",
          "side": "open_long",
          "created_at": 1748915204704,
          "counter_party": "ACzEZTg...",
          "cause": "normal"
        }
      ]

Field
Type
Description

`"history_id"`

integer

History id of trade

`"order_id"`

integer

Order id of order that resulted in the trade

`"client_order_id"`

UUID

CLOID of order that resulted in the trade

`"symbol"`

string

Trading pair symbol

`"amount"`

decimal string

Amount (in token denomination) of the trade event

`"price"`

decimal string

Current price of the specified symbol

`"entry_price"`

decimal string

Price at which the trade event was executed

`"fee"`

decimal string

Fee paid by the trade event

`"pnl"`

decimal string

PnL generated by the trade event

`"event_type"`

string

`"fulfill_taker"` if maker `"fulfill_maker"` if taker

`"side"`

string

`"open_long" "open_short" "close_long" "close_short"`

`"created_at"`

integer

Timestamp in milliseconds when the trade event occurred

`"counter_party"`

string

Account address of the counterparty of the trade event.

`"cause"`

string

`"normal"` regular user-initiated trading `"market_liquidation"` position was liquidated due to insufficient margin `"backstop_liquidation"` position was liquidated by backstop mechanism `"settlement"` position was closed due to Auto-Deleveraging (ADL) or other settlement

Field
Type
Description

`'event_type'`

string

`"fulfill_taker"` if maker `"fulfill_maker"` if taker

`'side'`

string

`"open_long" "open_short" "close_long" "close_short"`

`'cause'`

string

`"normal"` regular user-initiated trading `"market_liquidation"` position was liquidated due to insufficient margin `"backstop_liquidation"` position was liquidated by backstop mechanism `"settlement"` position was closed due to Auto-Deleveraging (ADL) or other settlement

- Status 400: Invalid request parameters

- Status 401: Unauthorized access

- Status 500: Internal server error

####
Code Example (Python)

    import requests

    response = requests.get(
        "/api/v1/positions/history?account=42trU9A5...&symbol=BTC&limit=100&offset=0",
        headers={"Accept": "*/*"},
    )

    data = response.json()

Previous Get positions
Next Get funding history

Last updated 3 months ago