Order
Represents an order in the Drift protocol. Contains all information about an order including its status, type, price, and fill information.Fields
Slot when the order was placed
The limit price for the order (in quote asset units)
The amount of base asset to buy or sell
The amount of base asset filled so far
The amount of quote asset filled so far
Price at which a trigger order will be executed
Starting price for auction orders
Ending price for auction orders
Maximum timestamp for order validity
Offset from oracle price for oracle-based orders
Unique order ID assigned by the protocol
Index of the market this order is for
Current status of the order (e.g., Open, Filled, Cancelled)
Type of order (e.g., Market, Limit, TriggerMarket, TriggerLimit)
Whether this is a Spot or Perp order
User-defined order ID for easier tracking
Direction of the existing position (Long or Short)
Direction of this order (Long or Short)
If true, order can only reduce an existing position
If true, order will only be placed as a maker order
If true, order will be cancelled if not immediately filled
Condition for trigger orders (Above, Below, etc.)
Duration of the auction period in slots
Lower 8 bits of the slot when order was posted
Bit flags for additional order properties
OrderParams
Parameters used to place a new order. This struct is passed to order placement functions.Fields
Type of order (Market, Limit, TriggerMarket, TriggerLimit, Oracle)
Spot or Perp market
Long or Short
User-defined ID for tracking (0-255)
Amount of base asset to trade
Limit price for the order
Index of the market to trade on
Whether this order can only reduce existing position
Post-only behavior (None, MustPostOnly, TryPostOnly, Slide)
Additional order flags
Maximum timestamp for order validity
Trigger price for conditional orders
Trigger condition (Above, Below, TriggeredAbove, TriggeredBelow)
Offset from oracle price (for oracle orders)
Duration of auction period in slots
Starting price for auction
Ending price for auction
Example
ModifyOrderParams
Parameters for modifying an existing order. All fields are optional - only specified fields will be updated.Fields
Update order direction
Update base asset amount
Update limit price
Update reduce-only flag
Update post-only behavior
Update bit flags
Update maximum timestamp
Update trigger price
Update trigger condition
Update oracle price offset
Update auction duration
Update auction start price
Update auction end price
Modification policy