v2-equivalant-ohlc-and-volume-inUSD

Returns the latest DEX trade by token on Ethereum, where currency smart contract is 0xb23d…28CF, side currency smart contract is 0xC02a…6Cc2 and DEX protocol family is Uniswap: block time, currency symbol, smart contract, price in USD, trade amount, side currency symbol, side smart contract and 4 more fields.

By Kshitij Mahajan · saved 26 September 2024 · run 10 times · Bitquery API v2

What it returns

Filters

The query

query MyQuery {
  EVM(network: eth) {
    DEXTradeByTokens(
      where: {Trade: {Currency: {SmartContract: {is: "0xb23d80f5FefcDDaa212212F028021B41DEd428CF"}}, Side: {Currency: {SmartContract: {is: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"}}}, PriceAsymmetry: {lt: 1}, Dex: {ProtocolFamily: {is: "Uniswap"}}}}
      limit: {count: 1}
      orderBy: {descending: Block_Time}
    ) {
      Block {
        Time(interval: {count: 30, in: minutes})
      }
      Trade {
        Currency {
          Symbol
          SmartContract
        }
        open: PriceInUSD(minimum: Block_Number)
        close: PriceInUSD(maximum: Block_Number)
        high: PriceInUSD(maximum: Trade_PriceInUSD)
        low: PriceInUSD(minimum: Trade_PriceInUSD)
        Amount
        Side {
          Currency {
            Symbol
            SmartContract
          }
          Amount
        }
        Price
      }
      trades: count
      volume: sum(of: Trade_AmountInUSD)
    }
  }
}

Similar queries