Skip to content

Instantly share code, notes, and snippets.

@lukesaunders
Created August 20, 2020 17:15
Show Gist options
  • Save lukesaunders/19a17b5031bf7c2a1c645fcbd759e7a5 to your computer and use it in GitHub Desktop.
Save lukesaunders/19a17b5031bf7c2a1c645fcbd759e7a5 to your computer and use it in GitHub Desktop.
type Query {
pool(poolId: String!): Pool
pools(orderBy: PoolOrderAttribute, limit: Int): [Pool]
poolHistory(from: Int, until: Int, interval: Interval): PoolHistory
}
# A type representing the current state of a pool. To get historical data or averages use XXX
type Pool {
# the asset name in the format "CHAIN.TICKER-SYMBOL" e.g. "BNB.BTCB-101"
asset: String!
# status of a pool (bootstrapped, enabled, disabled)
status: String!
# current price of the asset in RUNE
price: String!
# sum of all ASSET stakes for all time since pool creation denominated in ASSET
assetStakedTotal: String!
# sum of all RUNE stakes for all time since pool creation denominated in RUNE
runeStakedTotal: String!
# RUNE value staked total: runeStakedTotal + (assetStakedTotal * assetPrice)
poolStakedTotal: String!
# current asset balance in ASSET
assetDepth: String!
# current balance in RUNE
runeDepth: String!
# combined total balance: 2 * runeDepth
poolDepth: String!
# total stake units (LP shares) in that pool
poolUnits: String!
# current ASSET ROI
currentAssetROI: String!
# current RUNE ROI
currentRuneROI: String!
}
enum PoolOrderAttribute {
DEPTH
VOLUME
}
enum Interval {
# 24 hour period
DAY
# 7 day period
WEEK
# month period
MONTH
}
type PoolHistory {
swaps: PoolSwaps
fees: PoolFees
slippage: PoolSlippage
}
# aggregate staking activity during a certain time period for all or a specific pool
type PoolStakes {
# the number of stake and unstake transactions in this period
totalCount: String!
# the number of stake transactions in this period
stakeCount: String!
# the number of unstake transactions in this period
unstakeCount: String!
# net of all stake units issued and redeemed in this period
stakeUnitsTotal: String!
# net of all assets staked and unstaked in this period
assetTotal: String!
# net of all RUNE staked and unstaked in this period
runeTotal: String!
}
# aggregate swap activity during a certain time period for all or a specific pool
type PoolSwaps {
# the number of swaps in this period
totalCount: String!
# the number of buys in this period
buyCount: String!
# the number of sells in this period
sellCount: String!
# total volume: buyVolume + sellVolume
totalVolume
# total volume for ASSET->RUNE (in RUNE)
buyVolume
# total volume for RUNE->ASSET (in RUNE)
sellVolume
}
# aggregate fees incurred from swaps during a certain time period for all or a specific pool
type PoolFees {
# total fees in RUNE: buyFees + sellFees
totalFees
# total buy fees in RUNE
buyFees
# total sell fees in RUNE
sellFees
# poolFees / totalCount
meanFees
# buyFees / totalCount
meanBuyFees
# sellFees / totalCount
meanSellFees
}
# aggregate slippage incurred from swaps during a certain time period for all or a specific pool
type PoolSlippage {
# total slippage in RUNE: buySlippage + sellSlippage
totalSlippage
# total buy slippage in RUNE
buySlippage
# total sell slippage in RUNE
sellSlippage
# poolSlippage / totalCount
meanPoolSlippage
# buySlippage / totalCount
meanBuySlippage
# sellSlippage / totalCount
meanSellSlippage
}
# example query
# {
# pools(orderBy: DEPTH, limit: 2) {
# asset
# status
# price
# }
# poolHistory(from: 1597338605, interval: DAY) {
# swaps {
# totalCount
# totalVolume
# }
# fees {
# totalFees
# meanPoolFees
# }
# slippage {
# totalSlippage
# meanPoolSlippage
# }
# }
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment