ton top pairs

Returns 100 DEX trades by token on TON, where block time since 2024-10-20, sorted by USD, highest first: currency symbol, currency name, smart contract address, workchain, native, side currency symbol, side currency name and 11 more fields.

By Nadia · saved 23 October 2024 · Bitquery API v2

What it returns

Filters

The query

query ($min_count: String, $time_ago: DateTime, $pton: String!, $usdt: String!, $time_10min_ago: DateTime, $time_1h_ago: DateTime, $time_3h_ago: DateTime) {
  Ton {
    DEXTradeByTokens(
      where: {Block: {Time: {since: $time_ago}},
        any: [
          {Trade: {Side: {Currency: {Native: true}}}}, 
          {Trade: {Side: {Currency: {SmartContract: {Address: {is: $usdt}}}},
            Currency: {Native: false}}},
          {Trade: {Side: {Currency: {SmartContract: {Address: {is: $pton}}}},
            Currency: {SmartContract: {Address: {notIn: [$usdt]}}}}},
          {Trade: {Side: {Currency: {Native: false, SmartContract: {Address: {notIn: [$pton, $usdt]}}}},
            Currency: {Native: false, SmartContract: {Address: {notIn: [$pton, $usdt]}}}}}
        ]}
      orderBy: {descendingByField: "usd"}
      limit: {count: 100}
    ) {
      Trade {
        Currency {
          Symbol
          Name
          SmartContract {
            Address
            Workchain
          }
          Native
        }
        Side {
          Currency {
            Symbol
            Name
            SmartContract {
              Address
              Workchain
            }
            Native
          }
        }
        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}}}
        )
      }
      Block{min_time:Time(minimum:Block_Time) max_time: Time(maximum:Block_Time)}
      dexes: uniq(of: Trade_Dex_SmartContract_Address)
      amount: sum(of: Trade_Side_Amount)
      usd: sum(of: Trade_Side_AmountInUSD)
      sellers: uniq(of: Trade_Seller_Address)
      buyers: uniq(of: Trade_Buyer_Address)
      count(selectWhere: {ge: $min_count})
    }
  }
}

Variables

{
  "time_10min_ago": "2024-10-23T06:39:02Z",
  "time_1h_ago": "2024-10-23T05:49:02Z",
  "time_3h_ago": "2024-10-23T03:49:02Z",
  "time_ago": "2024-10-20T06:49:02Z",
  "usdc": "EQB-MPwrd1G6WKNkLz_VnV6WqBDd142KMQv-g1O-8QUA3728",
  "usdt": "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs",
  "pton": "EQAyvcnP0RexLvnsQMXfKYnk18Bzl3Y-iGt6bXqFB75ugXmE",
  "min_count": "10"
}

Similar queries