Get Price, Trading Volume, Trade Count of all Tokens in a Single API

Using the same method anyone can get the OHLC for all the tokens in 1 API call.

{
  ethereum(network: bsc) {
    dexTrades(
      options: {limitBy: {each: "baseCurrency.address", limit: 1}, desc: ["timeInterval.minute"]}
      date: {since: "2021-06-01"}
      exchangeName: {is: "Pancake"}
      quoteCurrency: {is: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"}
    ) {
      timeInterval {
        minute(count: 5)
      }
      baseCurrency {
        symbol
        address
      }
      baseAmount
      quoteCurrency {
        symbol
        address
      }
      quoteAmount
      trades: count
      quotePrice
      maximum_price: quotePrice(calculate: maximum)
      minimum_price: quotePrice(calculate: minimum)
      median_price: quotePrice(calculate: median)
      open_price: minimum(of: block, get: quote_price)
      close_price: maximum(of: block, get: quote_price)
    }
  }
}
3 Likes