Get Trade History

Method Name

private/get_trade_history

Get trade history for a subaccount, with filter parameters.

Parameters

subaccount_id integer required
Subaccount_id for which to get trades
from_timestamp integer
Earliest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to 0.
instrument_name string
Instrument name to filter by
order_id string
Order id to filter by
page integer
Page number of results to return (default 1, returns last if above num_pages)
page_size integer
Number of results per page (default 100, max 1000)
to_timestamp integer
Latest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to returning all data up to current time.

Response

id string or integer required
result object required
result.subaccount_id integer required
Subaccount_id for which to get the trade history
result.pagination object required
Pagination info
result.pagination.count integer required
Total number of items, across all pages
result.pagination.num_pages integer required
Number of pages
result.trades array of objects required
List of trades
result.trades[].direction string required
Order direction
enum buy sell
result.trades[].index_price string required
Index price of the underlying at the time of the trade
result.trades[].instrument_name string required
Instrument name
result.trades[].is_transfer boolean required
Whether the trade was generated through private/transfer_position
result.trades[].label string required
Optional user-defined label for the order
result.trades[].liquidity_role string required
Role of the user in the trade
enum maker taker
result.trades[].mark_price string required
Mark price of the instrument at the time of the trade
result.trades[].order_id string required
Order ID
result.trades[].quote_id string or null required
Quote ID if the trade was executed via RFQ
result.trades[].realized_pnl string required
Realized PnL for this trade
result.trades[].subaccount_id integer required
Subaccount ID
result.trades[].timestamp integer required
Trade timestamp (in ms since Unix epoch)
result.trades[].trade_amount string required
Amount filled in this trade
result.trades[].trade_fee string required
Fee for this trade
result.trades[].trade_id string required
Trade ID
result.trades[].trade_price string required
Price at which the trade was filled
result.trades[].tx_hash string or null required
Blockchain transaction hash
result.trades[].tx_status string required
Blockchain transaction status
enum requested pending settled reverted ignored

Example

{request_example_shell}
{request_example_javascript}
{request_example_python}

The above command returns JSON structured like this:

{response_example_json}