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
1
{
2
perpetuals(where: {id: "0xdb282bbace4e375ff2901b84aceb33016d0d663d-0"}) {
3
index
4
symbol
5
underlying
6
oracleAddress
7
collateralName
8
collateralAddress
9
operatorAddress
10
position
11
entryValue
12
openInterest
13
lpTotalPNL
14
totalFee
15
totalVolume
16
}
17
}
Copied!

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
1
{
2
trades(first: 10 orderBy:timestamp orderDirection:desc,
3
where: {perpetual: "0xdb282bbace4e375ff2901b84aceb33016d0d663d-0"}) {
4
id
5
perpetual {
6
id
7
}
8
trader {
9
id
10
}
11
price
12
markPrice
13
fee
14
isClose
15
pnl
16
type
17
transactionHash
18
blockNumber
19
timestamp
20
logIndex
21
}
22
}
Copied!

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
1
{
2
fundingRateMinDatas(first: 10 orderBy:timestamp orderDirection:desc,
3
where: {perpetual: "0xdb282bbace4e375ff2901b84aceb33016d0d663d-0"}) {
4
perpetual {
5
id
6
}
7
fundingRate
8
timestamp
9
}
10
}
Copied!

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
1
{
2
liquidates(first: 10 orderBy:timestamp orderDirection:desc,
3
where: {perpetual: "0xdb282bbace4e375ff2901b84aceb33016d0d663d-0"}) {
4
id
5
perpetual {
6
id
7
}
8
trader
9
liquidator
10
amount
11
price
12
markPrice
13
penalty
14
penaltyToLP
15
type
16
transactionHash
17
blockNumber
18
timestamp
19
logIndex
20
}
21
}
Copied!

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
1
{
2
tradeDayDatas(first: 10 orderBy:timestamp orderDirection:desc,
3
where: {perpetual: "0xdb282bbace4e375ff2901b84aceb33016d0d663d-0"}) {
4
id
5
perpetual {
6
id
7
}
8
timestamp
9
open
10
close
11
low
12
high
13
volume
14
}
15
}
Copied!
Last modified 14d ago