token pair data

Returns the latest transfer on Base, where transfer receiver is 0x4c36…4b18, pair smart contract is 0x4c36…4b18 and currency smart contract is 0xd9aa…b6ca: transfer amount, smart contract, sum of trade buy amount, sum of trade sell amount, count and trade price.

By gaurav · saved 29 June 2024 · run 6 times · Bitquery API v2

What it returns

Filters

The query

query PairData($pairAddress: String!, $network: evm_network!, $createdAt: String!, $tokenAddress: String!, $weth: String!) {
  EVM(dataset: combined, network: $network) {
    initialLiquidity: Transfers(
      limit: {count: 2}
      orderBy: {ascending: Block_Time}
      where: {Transfer: {Receiver: {is: $pairAddress}}}
    ) {
      Transfer {
        Amount
        Currency {
          SmartContract
        }
      }
    }
    volume: DEXTrades(
      where: {Block: {Date: {since: $createdAt}}, Trade: {Dex: {Pair: {SmartContract: {is: $pairAddress}}}}}
    ) {
      token1_vol: sum(of: Trade_Buy_Amount)
      token2_vol: sum(of: Trade_Sell_Amount)
      sellTrades: count(
        if: {Trade: {Buy: {Currency: {SmartContract: {is: $tokenAddress}}}}}
      )
      buyTrades: count(if: {Trade: {Buy: {Currency: {SmartContract: {is: $weth}}}}})
    }
    price: DEXTradeByTokens(
      where: {Block: {Date: {since: $createdAt}}, Trade: {Dex: {Pair: {SmartContract: {is: $pairAddress}}}, Currency: {SmartContract: {is: $tokenAddress}}}}
      orderBy: {descending: Block_Time}
      limit: {count: 1}
    ) {
      Trade {
        Price
      }
    }
  }
}

Variables

{
  "network": "base",
  "pairAddress": "0x4c36388be6f416a29c8d8eee81c771ce6be14b18",
  "createdAt": "2024-01-29",
  "tokenAddress": "0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca",
  "weth": "0x4200000000000000000000000000000000000006"
}

Similar queries