Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Order Types and Fields

Reference for the types and fields used when building order transactions. For the signing and submission flow, see Transaction Signing. For decimal encoding, see Decimal Encoding.

Order Types

VariantBehavior
Limitstandard limit order, rests on the book until filled or cancelled
PostOnlyrejected if it would immediately match (guarantees maker execution)
FillOrKillmust fill entirely in one match or the entire order is cancelled
ImmediateOrCancelfills as much as possible immediately, cancels any remaining size
PostOnlySlideif the limit price would cross, slides to the best non-crossing price instead of rejecting
PostOnlyFrontposts at the front of the queue at the best price that doesn’t cross

NewOrderArgs

FieldTypeDescription
priceSurrogateDecimalorder price — see Decimal Encoding
sizeSurrogateDecimalorder size
sideSideBid (buy) or Ask (sell)
order_typeOrderTypeone of the order types above
reduce_onlyboolif true, can only reduce an existing position — rejected if it would open or increase one
client_order_idOption<ClientOrderId>optional user-defined u64 identifier; returned in order updates and usable for cancels
pending_tpsl_pairOption<PendingTpslPair>optional take-profit / stop-loss pair attached to the order

Take-Profit / Stop-Loss (TP/SL)

A PendingTpslPair attaches conditional exit orders to a placement. Each leg is optional:

FieldTypeDescription
take_profitOption<TpslLeg>triggers when price reaches the target
stop_lossOption<TpslLeg>triggers when price hits the stop level
dynamic_sizeboolif true, the TP/SL size tracks the current position size at trigger time

Each TpslLeg contains:

FieldTypeDescription
trigger_priceSurrogateDecimalprice at which the leg activates
order_priceOption<SurrogateDecimal>limit price for the triggered order; None for market execution
trigger_conditionTriggerPriceConditionMark (mark price), Oracle (oracle price), or LastTrade

Sub-Account Index

All call structs include a sub_account_index: Option<u8> field. This is reserved for future sub-account support. Set it to None for now.