MCDEX
Search…
Perpetual

Perpetual Basic Info

This section show you how to get perpetual information from Perpetual entity.

Entity: Perpetual

Field
Value Type
Description
id
ID
liquidity pool address + '-' + perpetual index
index
BigInt
perpetual index in this pool
symbol
String
perpetual symbol
underlying
String
underlying for this pepetual oracle
oracleAddress
String
oracle contract address
operatorAddress
String
operator address
collateralName
String
collateral name
collateralAddress
String
collateral contract address
liquidityPool
LiquidityPool
liquidityPool
totalVolumeUSD
BigDecimal
total trade volume(usd) in this perpetual
totalVolume
BigDecimal
total trade volume in this perpetual
totalFee
BigDecimal
total trade fee in this perpetual
txCount
BigInt
total trade count in this perpetual
liqCount
BigInt
total liquidate count in this perpetual
position
BigDecimal
amm position
entryValue
BigDecimal
amm entryValue
openInterest
BigDecimal
openInterest
createdAtTimestamp
BigInt
perpetual create timestamp
createdAtBlockNumber
BigInt
perpetual create block
state
Int
state
lpTotalPNL
BigDecimal
lp PNL

Query Example

Query BUSD Pool's BTC perpetual information bsc: getPerpetualInfo
{
perpetuals(where: {id: "0xdb282bbace4e375ff2901b84aceb33016d0d663d-0"}) {
index
symbol
underlying
oracleAddress
collateralName
collateralAddress
operatorAddress
position
entryValue
openInterest
lpTotalPNL
totalFee
totalVolume
}
}

Trade History

This section shows how to get trade from Trade entity.

Entity: Trade

Field
Value Type
Description
id
ID
trasaction hash + "-" + logIndex + "-" + close/open
perpetual
Perpetual
Perpetual of this trade
trader
User
trader of this trade
amount
BigDecimal
amount of this trade
price
BigDecimal
price of this trade
markPrice
BigDecimal
markPrice of this trade
fee
BigDecimal
fee of this trade
isClose
Boolean
true if this trade is close
pnl
BigDecimal
profit and loss
type
Int
type of this trade (NORMAL = 0, LIQUIDATEBYAMM = 1, LIQUIDATEBYTRADER = 2)
transactionHash
String
transaction hash of this trade
blockNumber
BigInt
block number of this trade
timestamp
BigInt
timestamp of this trade
logIndex
BigInt
log index of this trade

Query Example

Query BUSD Pool's BTC perpetual trade history bsc: getPerpetualTrades
{
trades(first: 10 orderBy:timestamp orderDirection:desc,
where: {perpetual: "0xdb282bbace4e375ff2901b84aceb33016d0d663d-0"}) {
id
perpetual {
id
}
trader {
id
}
price
markPrice
fee
isClose
pnl
type
transactionHash
blockNumber
timestamp
logIndex
}
}

Funding Rate History

This section show you how to get funding rate from FundingRateHourData & FundingRateMinData entities.

Entity: FundingRateHourData & FundingRateMinData

FundingRateHourData & FundingRateMinData collect all UpdateFundingRate event information to aggregate entities.
Field
Value Type
Description
id
ID
perpetual index + "-" + timeindex (timestamp / 60 for min, timestamp / 3600 for hour)
perpetual
Perpetual
perpetual of this funding rate
fundingRate
BigDecimal
funding rate
timestamp
BigInt
timestamp

Query Example

Query BUSD Pool's BTC perpetual fundingRates bsc: getPerpetualFundingRate
{
fundingRateMinDatas(first: 10 orderBy:timestamp orderDirection:desc,
where: {perpetual: "0xdb282bbace4e375ff2901b84aceb33016d0d663d-0"}) {
perpetual {
id
}
fundingRate
timestamp
}
}

Liquidate History

This section shows how to get trade from Liquidate entity.

Entity: Liquidate

Field
Value Type
Description
id
ID
trasaction hash + "-" + logIndex
perpetual
Perpetual
Perpetual of this liquidate
trader
User
trader of this liquidate
liquidator
User
liquidator of this liquidate
amount
BigDecimal
amount of this liquidate
price
BigDecimal
price of this liquidate
markPrice
BigDecimal
markPrice of this liquidate
penalty
BigDecimal
penalty of this liquidate
penaltyToLP
BigDecimal
penalty to LP
type
Int
type of this liquidate (LIQUIDATEBYAMM = 1, LIQUIDATEBYTRADER = 2)
transactionHash
String
transaction hash of this liquidate
blockNumber
BigInt
block number of this liquidate
timestamp
BigInt
timestamp of this liquidate
logIndex
BigInt
log index of this liquidate

Query Example

Query BUSD Pool's BTC perpetual liquidate history bsc: getPerpetualLiquidates
{
liquidates(first: 10 orderBy:timestamp orderDirection:desc,
where: {perpetual: "0xdb282bbace4e375ff2901b84aceb33016d0d663d-0"}) {
id
perpetual {
id
}
trader
liquidator
amount
price
markPrice
penalty
penaltyToLP
type
transactionHash
blockNumber
timestamp
logIndex
}
}

Perpetual Volume

This section show you how to get volume for specific perpetual from Trade15MinData & TradeHourData & TradeDayData & TradeSevenDayData entities.

Entity: Trade15MinData & TradeHourData & TradeDayData & TradeSevenDayData

Field
Value Type
Description
id
ID
perpetual index + "-" + timeindex
perpetual
Perpetual
Perpetual of these trades
timestamp
Int
timestamp of these trades in timeindex
open
BigDecimal
open price of these trades in timeindex
close
BigDecimal
close price of these trades in timeindex
low
BigDecimal
low price of these trades in timeindex
high
BigDecimal
high price of these trades in timeindex
volume
BigDecimal
volume of these trades in timeindex

Query Example

Query BUSD Pool's BTC perpetual trade history bsc: getPerpetualTradesCandles
{
tradeDayDatas(first: 10 orderBy:timestamp orderDirection:desc,
where: {perpetual: "0xdb282bbace4e375ff2901b84aceb33016d0d663d-0"}) {
id
perpetual {
id
}
timestamp
open
close
low
high
volume
}
}
Last modified 10mo ago
Copy link
On this page
Perpetual Basic Info
Entity: Perpetual
Query Example
Trade History
Entity: Trade
Query Example
Funding Rate History
Entity: FundingRateHourData & FundingRateMinData
Query Example
Liquidate History
Entity: Liquidate
Query Example
Perpetual Volume
Entity: Trade15MinData & TradeHourData & TradeDayData & TradeSevenDayData
Query Example