Skip to main content
Enums and variant types used for classification and state management in Drift Protocol.

OrderType

Defines the type of order.
Values:
  • LIMIT - Standard limit order that executes at specified price or better
  • TRIGGER_MARKET - Market order triggered when price condition is met
  • TRIGGER_LIMIT - Limit order triggered when price condition is met
  • MARKET - Immediate execution at best available price
  • ORACLE - Order priced relative to oracle price with offset

MarketType

Specifies whether an order/position is for perpetual or spot markets.
Values:
  • SPOT - Spot market (immediate settlement)
  • PERP - Perpetual futures market

PositionDirection

Defines the direction of a position or order.
Values:
  • LONG - Long position (buy/bullish)
  • SHORT - Short position (sell/bearish)

OrderStatus

Indicates the current status of an order.
Values:
  • INIT - Order initialized but not yet active
  • OPEN - Order is active and can be filled
  • FILLED - Order has been completely filled
  • CANCELED - Order has been canceled

OrderTriggerCondition

Defines when a trigger order should activate.
Values:
  • ABOVE - Trigger when price goes above trigger price
  • BELOW - Trigger when price goes below trigger price
  • TRIGGERED_ABOVE - Above condition has been triggered
  • TRIGGERED_BELOW - Below condition has been triggered

PostOnlyParams

Defines post-only behavior for orders.
Values:
  • NONE - No post-only requirement
  • MUST_POST_ONLY - Transaction fails if order can’t be maker-only
  • TRY_POST_ONLY - Order not placed if can’t be maker-only, but transaction succeeds
  • SLIDE - Price modified to ensure maker-only if needed

SizeDistribution

How to distribute order sizes across scale orders.
Values:
  • FLAT - Equal size for all orders
  • ASCENDING - Smallest at start price, largest at end price
  • DESCENDING - Largest at start price, smallest at end price

MarketStatus

Indicates the operational status of a market.
Values:
  • INITIALIZED - Market created but not yet active
  • ACTIVE - Market is fully operational
  • FUNDING_PAUSED - Funding rate updates paused
  • AMM_PAUSED - AMM operations paused
  • FILL_PAUSED - Order fills paused
  • WITHDRAW_PAUSED - Withdrawals paused
  • REDUCE_ONLY - Only position-reducing orders allowed
  • SETTLEMENT - Market in settlement mode
  • DELISTED - Market has been delisted

SpotBalanceType

Indicates whether a spot position is a deposit or borrow.
Values:
  • DEPOSIT - User has deposited/lent tokens
  • BORROW - User has borrowed tokens

OracleSource

Specifies the oracle provider for price feeds.
Common Values:
  • PYTH - Standard Pyth oracle
  • PYTH_PULL - Pyth pull-based oracle
  • SWITCHBOARD - Switchboard oracle
  • SWITCHBOARD_ON_DEMAND - Switchboard on-demand oracle
  • QUOTE_ASSET - Uses quote asset as oracle (for stablecoins)

ContractType

Type of perpetual contract.
Values:
  • PERPETUAL - Perpetual futures (no expiry)
  • FUTURE - Dated futures (with expiry)
  • PREDICTION - Prediction market

ContractTier

Risk tier classification for perpetual markets.
Values:
  • A - Tier A (lowest risk, best margin terms)
  • B - Tier B (moderate risk)
  • C - Tier C (higher risk)
  • SPECULATIVE - Speculative assets
  • HIGHLY_SPECULATIVE - Highly speculative assets
  • ISOLATED - Isolated margin only

AssetTier

Risk tier classification for spot assets.
Values:
  • COLLATERAL - Can be used as collateral
  • PROTECTED - Protected asset status
  • CROSS - Cross-margin enabled
  • ISOLATED - Isolated margin only
  • UNLISTED - Not listed for trading

MarginMode

Margin mode for user accounts.
Values:
  • DEFAULT - Standard margin requirements
  • HIGH_LEVERAGE - High leverage mode enabled
  • HIGH_LEVERAGE_MAINTENANCE - High leverage in maintenance mode

OrderAction

Type of order action event.
Values:
  • PLACE - Order was placed
  • CANCEL - Order was canceled
  • EXPIRE - Order expired
  • FILL - Order was filled
  • TRIGGER - Trigger order was activated

LiquidationType

Type of liquidation.
Values:
  • LIQUIDATE_PERP - Liquidate perpetual position
  • LIQUIDATE_SPOT - Liquidate spot position
  • LIQUIDATE_BORROW_FOR_PERP_PNL - Liquidate borrow to cover perp PnL
  • LIQUIDATE_PERP_PNL_FOR_DEPOSIT - Use perp PnL to cover deposit
  • PERP_BANKRUPTCY - Perpetual position bankruptcy
  • SPOT_BANKRUPTCY - Spot position bankruptcy

UserStatus

Status flags for user accounts.
Values:
  • BEING_LIQUIDATED (1) - Account is being liquidated
  • BANKRUPT (2) - Account is bankrupt
  • REDUCE_ONLY (4) - Account in reduce-only mode
  • ADVANCED_LP (8) - Advanced liquidity provider
  • PROTECTED_MAKER (16) - Protected maker status

ExchangeStatus

Global exchange status flags.
Values:
  • ACTIVE (0) - Exchange fully operational
  • DEPOSIT_PAUSED (1) - Deposits paused
  • WITHDRAW_PAUSED (2) - Withdrawals paused
  • AMM_PAUSED (4) - AMM operations paused
  • FILL_PAUSED (8) - Order fills paused
  • LIQ_PAUSED (16) - Liquidations paused
  • FUNDING_PAUSED (32) - Funding updates paused
  • SETTLE_PNL_PAUSED (64) - PnL settlement paused
  • PAUSED (255) - All operations paused