Perpetual markets allow users to trade with leverage without an expiry date. Each perp market has its own account containing market configuration, AMM state, and funding rate data.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/drift-labs/protocol-v2/llms.txt
Use this file to discover all available pages before exploring further.
Get Perp Market Account
Retrieve a perpetual market account by its market index:Force Fetch from RPC
Force a fetch from RPC before returning the account (useful for testing):Get All Perp Markets
Retrieve all perpetual market accounts:PerpMarketAccount Structure
ThePerpMarketAccount type contains all data for a perpetual market.
The unique identifier for this perp market
The on-chain address of this market account
Current status of the market (e.g., active, paused, settlement, delisted)
Type of contract: perpetual, future, or prediction
Risk tier classification: A, B, C, speculative, highly speculative, or isolated
Market name as byte array (use
decodeName() to convert to string)Automated Market Maker state containing reserves, oracle info, and funding data
Initial margin ratio required to open positions (in margin precision 10000)
Maintenance margin ratio to avoid liquidation (in margin precision 10000)
Initial margin fraction factor for size-based margin increases
IMF factor applied to unrealized PnL for margin calculations
Asset weight applied to positive unrealized PnL for initial margin
Asset weight applied to positive unrealized PnL for maintenance margin
Count of users with open positions in this market
Total count of users interacting with this market
PnL pool used to settle positive user PnL
Fee paid to liquidators (in percentage precision)
Fee paid to insurance fund during liquidations
Expiry timestamp for future contracts (0 for perpetuals)
Settlement price for expired futures