MCDEX
Search…
Get Perpetual Info
This guide shows how to get perpetual info by using getLiquidityPool function and index of perpetual.

Get Perpetual Info Object

Can reference Quick Start to know how to get reader object and Get Pool Info to know how to get pool object.

Function

pool.perpetuals.get(perpetualIndex) from pool object
parameters
type
description
perpetualIndex
number
index of perpetual in the liquidity pool
Return information from perpetual object
returns
type
description
nums
array of number
  • [0]: markPrice: mark price
  • [1]: indexPrice: index price
  • [2]: fundingRate: funding rate
  • [3]: unitAccumulativeFunding: accumulative amount of funding for each unit
  • [4]: initialMarginRate: initial margin rate
  • [5]: maintenanceMarginRate: maintenance margin rate
  • [6]: operatorFeeRate: operator fee rate
  • [7]: lpFeeRate: LP fee rate
  • [8]: referrerRebateRate: referrer rebate rate
  • [9]: liquidationPenaltyRate: penalty rate if position is liquidated
  • [10]: keeperGasReward: gas reward for keeper
  • [11]: insuranceFundRate: insurance fund rate

Example

1
const pool = await getLiquidityPool(reader, liquidityPoolAddress)
2
const perpetual = pool.perpetuals.get(0)
Copied!
After getting perpetual object, can get useful information like previous section. EX: markPrice, fundingRate
1
console.log("markPrice: " + perpetual.markPrice.toString())
2
console.log("fundingRate: " + perpetual.fundingRate.toString())
Copied!

Sample Code

Perpetual
Last modified 23d ago