Trading
Private

Retrieves all trades that were executed from a specific order. When an order is filled, it may result in multiple trades (partial fills). This method returns all trades associated with a given order ID.

Results can be sorted in ascending or descending order by trade ID. Use historical to retrieve historical trade data. This is useful for tracking how an order was filled and analyzing execution quality.

Main accounts may use the subaccount_id parameter to retrieve trade data for a specific subaccount (requires mainaccount scope).

📖 Related Article: Accessing Historical Trades and Orders Using API

Scope: trade:read

Try in API console

get/private/get_user_trades_by_order

Query parameters

order_idstring required

Unique order identifier

Example:ETH-100234

The order id

sorting'asc' | 'desc' | 'default'

Direction of results sorting (default value means no sorting, results will be returned in order in which they left the database)

historicalboolean

Determines whether historical trade and order records should be retrieved.

  • false (default): Returns recent records: orders for 30 min, trades for 24h.
  • true: Fetches historical records, available after a short delay due to indexing. Recent data is not included.

📖 Related Article: Accessing Historical Trades and Orders Using API

subaccount_idinteger
Example:9

Id of a subaccount

Response

Success response

jsonrpc'2.0' required

The JSON-RPC version (2.0)

idinteger

The id that was sent in the request

Example response

{
  "result": [
    {
      "instrument_name": "BTC-PERPETUAL",
      "timestamp": 1517329113791,
      "starbase_timestamp": 1536569522277000000,
      "starbase_order_id": 103148386170,
      "block_trade_id": "154",
      "block_trade_leg_count": 3
    }
  ]
}

Changes

Changed in 3 of the 7 revisions of this API.15

    • added the optional property result/items/block_trade_leg_count to the response with the 200 status

      response-optional-property-added

    • added the optional property result/items/original_order_type to the response with the 200 status

      response-optional-property-added

    • added the optional property result/items/starbase_client_order_id to the response with the 200 status

      response-optional-property-added

    This revision also has 2 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

  • 430b3f0bc67c11See the full diff
    • removed the optional property result/items/block_trade_leg_count from the response with the 200 status

      response-optional-property-removed

    • added the optional property result/items/starbase_order_id to the response with the 200 status

      response-optional-property-added

    • added the optional property result/items/block_trade_leg_count to the response with the 200 status

      response-optional-property-added