latest ohlc

Returns the latest 10 DEX trades by token on Ethereum, where side currency smart contract is 0xC02a…6Cc2, pair smart contract is 0xE4b8…49e8 and block time after 2024-12-12: block time, sum of trade amount in USD, price in USD, trade price and count.

By gaurav · saved 12 December 2024 · Bitquery API v2

What it returns

Filters

The query

query EVMTokenPrice($pairAddress: String!, $timeInterval: OLAP_DateTimeIntervalUnits!, $intervalCount: Int!, $limit: Int!, $after: DateTime, $before: DateTime) {
  EVM(network: eth, dataset: realtime) {
    DEXTradeByTokens(
      orderBy: {descendingByField: "Block_timestamp"}
      where: {Trade: {Side: {Currency: {SmartContract: {is: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"}}}, Dex: {Pair: {SmartContract: {is: $pairAddress}}}}, Block: {Time: {after: $after, before: $before}}}
      limit: {count: $limit}
    ) {
      Block {
        timestamp: Time(interval: {in: $timeInterval, count: $intervalCount})
      }
      volume: sum(of: Trade_AmountInUSD)
      Trade {
        high: PriceInUSD(maximum: Trade_PriceInUSD)
        low: PriceInUSD(minimum: Trade_PriceInUSD)
        open: PriceInUSD(minimum: Block_Number)
        close: PriceInUSD(maximum: Block_Number)
        closeEth: Price(maximum: Block_Number)
      }
      count
    }
  }
}

Variables

{
  "pairAddress": "0xE4b8583cCB95b25737C016ac88E539D0605949e8",
  "timeInterval": "minutes",
  "intervalCount": 1,
  "after": "2024-12-12T10:38:45Z",
  "limit": 10
}

Similar queries