trending token pairs on Arbitrum

Historical data This query uses the realtime dataset (the default), which holds only a recent window - hours to days depending on the cube. For older data add a dataset to the top-level element: EVM(network: $network, dataset: combined) archive full history combined archive + realtime in one resu

By Kshitij Mahajan · saved 20 November 2024 · run 1 time · Bitquery API v2

What it returns

Filters

The query

# Historical data
#   This query uses the realtime dataset (the default), which holds only a
#   recent window - hours to days depending on the cube.
#
#   For older data add a dataset to the top-level element:
#
#     EVM(network: $network, dataset: combined)
#
#     archive   full history
#     combined  archive + realtime in one result
#
#   Archive and combined need the historical data add-on:
#   https://bitquery.io/pricing
#
# Datasets:  https://docs.bitquery.io/docs/graphql/dataset/archive/
# Retention: https://docs.bitquery.io/docs/graphql/data-coverage-retention/
#

query pairs($min_count: String, $network: evm_network, $time_ago: DateTime, $time_10min_ago: DateTime, $time_1h_ago: DateTime, $time_3h_ago: DateTime, $weth: String!, $usdc: String!, $usdt: String!, $usdc2: String!) {
  EVM(network: $network) {
    DEXTradeByTokens(
      where: {Block: {Time: {since: $time_ago}}, any: [{Trade: {Side: {Currency: {SmartContract: {is: $usdt}}}}}, {Trade: {Side: {Currency: {SmartContract: {is: $usdc}}}, Currency: {SmartContract: {notIn: [$usdt]}}}}, {Trade: {Side: {Currency: {SmartContract: {is: $usdc2}}}, Currency: {SmartContract: {notIn: [$usdt, $usdc]}}}}, {Trade: {Side: {Currency: {SmartContract: {is: $weth}}}, Currency: {SmartContract: {notIn: [$usdc, $usdt, $usdc2]}}}}, {Trade: {Side: {Currency: {SmartContract: {notIn: [$usdc, $usdt, $weth]}}}, Currency: {SmartContract: {notIn: [$usdc, $usdc2, $usdt, $weth]}}}}]}
      orderBy: {descendingByField: "usd"}
      limit: {count: 100}
    ) {
      Trade {
        Currency {
          Symbol
          Name
          SmartContract
          ProtocolName
        }
        Side {
          Currency {
            Symbol
            Name
            SmartContract
            ProtocolName
          }
        }
        price_last: PriceInUSD(maximum: Block_Number)
        price_10min_ago: PriceInUSD(
          maximum: Block_Number
          if: {Block: {Time: {before: $time_10min_ago}}}
        )
        price_1h_ago: PriceInUSD(
          maximum: Block_Number
          if: {Block: {Time: {before: $time_1h_ago}}}
        )
        price_3h_ago: PriceInUSD(
          maximum: Block_Number
          if: {Block: {Time: {before: $time_3h_ago}}}
        )
      }
      dexes: uniq(of: Trade_Dex_OwnerAddress)
      amount: sum(of: Trade_Side_Amount)
      usd: sum(of: Trade_Side_AmountInUSD)
      sellers: uniq(of: Trade_Seller)
      buyers: uniq(of: Trade_Buyer)
      count(selectWhere: {ge: $min_count})
    }
  }
}

Variables

{
  "network": "arbitrum",
  "time_10min_ago": "2024-11-20T07:35:03Z",
  "time_1h_ago": "2024-11-20T06:45:03Z",
  "time_3h_ago": "2024-11-20T04:45:03Z",
  "time_ago": "2024-11-17T07:45:03Z",
  "usdc": "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
  "usdt": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",
  "weth": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
  "usdc2": "0x7f5c764cbc14f9669b88837ca1490cca17c31607",
  "min_count": "100"
}

Similar queries