Skip to main content
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.

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

The PerpMarketAccount type contains all data for a perpetual market.
number
required
The unique identifier for this perp market
PublicKey
required
The on-chain address of this market account
MarketStatus
required
Current status of the market (e.g., active, paused, settlement, delisted)
ContractType
required
Type of contract: perpetual, future, or prediction
ContractTier
required
Risk tier classification: A, B, C, speculative, highly speculative, or isolated
number[]
required
Market name as byte array (use decodeName() to convert to string)
AMM
required
Automated Market Maker state containing reserves, oracle info, and funding data
number
required
Initial margin ratio required to open positions (in margin precision 10000)
number
required
Maintenance margin ratio to avoid liquidation (in margin precision 10000)
number
required
Initial margin fraction factor for size-based margin increases
number
required
IMF factor applied to unrealized PnL for margin calculations
number
required
Asset weight applied to positive unrealized PnL for initial margin
number
required
Asset weight applied to positive unrealized PnL for maintenance margin
number
required
Count of users with open positions in this market
number
required
Total count of users interacting with this market
PoolBalance
required
PnL pool used to settle positive user PnL
number
required
Fee paid to liquidators (in percentage precision)
number
required
Fee paid to insurance fund during liquidations
BN
required
Expiry timestamp for future contracts (0 for perpetuals)
BN
required
Settlement price for expired futures

Calculate Market Prices

Calculate bid and ask prices for a perp market:

Calculate Market Margin

Calculate margin requirements for a given position size: