orderHistory query returns your account’s terminated orders: fully filled, cancelled, rejected, or conditional orders that have triggered or been cancelled. Orders that are still resting or only partially filled do not appear here — query those with userOrders.
It shares its request parameters, pagination contract, and value conventions with userFills and userFundingFlows.
Request
string
required
Must be
"orderHistory".string
required
Your account ID. Must be greater than zero. A numeric value is also accepted.
int
Restrict results to one contract. Use
0 or omit for all contracts.int64
Inclusive start of the time window, in Unix milliseconds.
0 or omitted means unbounded.int64
Inclusive end of the time window, in Unix milliseconds.
0 or omitted means unbounded. A startTime later than endTime returns 400 BAD_REQUEST.int
Maximum rows in this page. Defaults to 1000, which is also the maximum; a larger value returns
400 BAD_REQUEST.Response
Envelope fields
int
Echoes the
contractId filter that was applied. 0 means no filter.int
Number of rows in this page. When
count equals your limit, another page may be available.boolean
true when the page was cut short at a row boundary because the response reached its byte ceiling.Order object fields
number
Time the order reached its final state, in Unix milliseconds. This is the field you page on.
number
Block height at which the order was finalized.
number
Sequence number within the block.
string
Exchange-assigned order ID.
string | null
The client order ID you assigned at placement, or
null when none was set.number
Contract the order was placed on.
number
Market deployer the contract belongs to.
string
"B" for buy, "S" for sell.string
L, M, SL, SM, TPL, or TPM. See the enum table below.string
Gtc, Alo, Ioc, or Fok.boolean
true when the order could only reduce an existing position.string
Trigger price for a conditional or TP/SL order (raw integer string).
"0" for an ordinary order.number
Which price feed the trigger watched:
0 for mark price, 1 for oracle price.string
Limit price of the order (raw integer string).
string
Original order quantity (raw integer string).
string
Quantity filled before the order terminated.
string
Quantity still unfilled when the order terminated.
string
Open, Filled, Canceled, or Untriggered.string
How the order came about. See the enum table below.
number
Signed cancellation reason.
-1 indicates a cancellation internal to the matching engine.number
Rejection code for a rejected order.
number
Time the order was created, in Unix milliseconds.
There is no order-level fee or realized-PnL total in this response. Derive both by summing the matching rows in
userFills for the same orderId.Pagination
Rows come back in ascendingupdatedTimeMs order, at most limit per page. Pass the last row’s updatedTimeMs as the next request’s startTime; because startTime is inclusive, deduplicate the repeated boundary row by orderId. A page with count below limit is the last one. See userFills for the full walkthrough.
