OHLCV_query optimzied more

Returns the latest DEX trade by token on BNB Chain, where side currency smart contract is 0xd6fd…44ec, currency smart contract is 0xbb4c…095c and DEX owner address is 0xcA14…0c73: chain ID, block time, sum of trade amount, trade price, side currency symbol, currency symbol and count.

By gaurav · saved 28 March 2024 · run 12 times · Bitquery API v2

What it returns

Filters

The query

query getTokenCandles($network: evm_network, $baseCurrency: String, $quoteCurrency: String, $limit: Int, $interval: Int, $timeframe: OLAP_DateTimeIntervalUnits) {
  EVM(network: $network, dataset: realtime) {
    DEXTradeByTokens(
      orderBy: {descendingByField: "Block_Time"}
      where: {Trade: {Side: {Currency: {SmartContract: {is: $baseCurrency}, Symbol: {}}}, Currency: {SmartContract: {is: $quoteCurrency}, Symbol: {}}, Price: {gt: 0, lt: 1.5}, Dex: {OwnerAddress: {is: "0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73"}}, Amount: {gt: "0.000000000000000001"}}}
      limit: {count: $limit}
    ) {
      ChainId
      Block {
        Time(interval: {in: $timeframe, count: $interval})
      }
      volume: sum(of: Trade_Amount)
      Trade {
        high: Price(maximum: Trade_Price)
        low: Price(minimum: Trade_Price)
        open: Price(minimum: Block_Number)
        close: Price(maximum: Block_Number)
        Side {
          Currency {
            Symbol
          }
        }
        Currency {
          Symbol
        }
      }
      count
    }
  }
}

Variables

{
  "baseCurrency": "0xd6fdde76b8c1c45b33790cc8751d5b88984c44ec",
  "interval": 1,
  "limit": 1,
  "network": "bsc",
  "quoteCurrency": "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
  "timeframe": "minutes"
}

Similar queries