OHLC for a token

Returns DEX trades by token on Ethereum, where currency smart contract is 0x2260…c599, sorted by block time: block time, price in USD and sum of trade side amount in USD.

By Akshat · saved 22 September 2024 · Bitquery API v2

What it returns

Filters

The query

query tradingView($network: evm_network, $token: String) {
  EVM(network: $network) {
    DEXTradeByTokens(
      orderBy: {ascendingByField: "Block_Time"}
      where: {Trade: {Currency: {SmartContract: {is: $token}}}}
    ) {
      Block {
        Time(interval: {count: 5, in: minutes})
      }
      Trade {
        open: PriceInUSD(minimum: Block_Number)
        close: PriceInUSD(maximum: Block_Number)
        max: PriceInUSD(maximum: Trade_PriceInUSD)
        min: PriceInUSD(minimum: Trade_PriceInUSD)
      }
      volume: sum(of: Trade_Side_AmountInUSD, selectWhere: {gt: "0"})
    }
  }
}

Variables

{
  "network": "eth",
  "token": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"
}

Similar queries