TRON query

Returns 100 DEX trades by token on Tron, where block time after 2024-09-24, sorted by USD, highest first: currency symbol, currency name, smart contract, native, side currency symbol, side currency name, side smart contract and 8 more fields.

By Aleksey · saved 24 September 2024 · Bitquery API v2

What it returns

Filters

The query

query ($min_count: String!, $time_10min_ago: DateTime, $time_1h_ago: DateTime, $time_3h_ago: DateTime, $wtrx: String!, $usdt: String!) {
  Tron {
    DEXTradeByTokens(
      where: {Transaction: {Result: {Success: true}}, Block: {Time: {after: $time_3h_ago}}, 
        any: [
          {Trade: {Side: {Currency: {Native: true}}}},
          {Trade: {Side: {Currency: {SmartContract: {is: $wtrx} }} Currency: {Native: false } }}
          {Trade: {Side: {Currency: {SmartContract: {is: $usdt} }} Currency: {Native: false SmartContract: {not: $wtrx}} }}
          {Trade: {Side: {Currency: {Native: false SmartContract: {notIn: [$usdt, $wtrx]} }} 
            						  Currency: {Native: false SmartContract: {notIn: [$usdt, $wtrx]}} }}
        ]
      }
      orderBy: {descendingByField: "usd"}
      limit: {count: 100}
    ) {
      Trade {
        Currency {
          Symbol
          Name
          SmartContract
          Native
        }
        Side {
          Currency {
            Symbol
            Name
            SmartContract
            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(minimum: Block_Number)
      }
      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

{
  "time_10min_ago": "2024-09-24T05:25:38Z",
  "time_1h_ago": "2024-09-24T04:35:38Z",
  "time_3h_ago": "2024-09-24T02:35:38Z",
  "wtrx": "TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR",
  "usdt": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
  "min_count": "10"
}

Similar queries