myown

Returns DEX trades by token on Tron, where currency smart contract is TM418q…sKJw, block time since 2024-12-23 and trade amount is above 0, sorted by block time: block time, quantile of trade price in USD, average of trade price in USD and sum of trade side amount in USD.

By Lisa Wall · saved 26 December 2024 · run 1 time · Bitquery API v2

What it returns

Filters

The query

query TokenOHLC($token: String, $dataset: dataset_arg_enum, $interval: Int, $time_ago: DateTime) {
  Tron(dataset: $dataset) {
    DEXTradeByTokens(
      orderBy: {ascendingByField: "Block_Time"}
      where: {Trade: {Amount: {gt: "0"}, Currency: {SmartContract: {is: $token}}}, Transaction: {Result: {Success: true}}, Block: {Time: {since: $time_ago}}}
    ) {
      Block {
        Time(interval: {count: $interval, in: minutes})
      }
      min: quantile(of: Trade_PriceInUSD, level: 0.05)
      max: quantile(of: Trade_PriceInUSD, level: 0.95)
      close: average(of: Trade_PriceInUSD)
      open: average(of: Trade_PriceInUSD)
      volume: sum(of: Trade_Side_AmountInUSD)
    }
  }
}

Variables

{
  "token": "TM418qpSkiqyeKdkKKb7YcmogazjQdsKJw",
  "time_ago": "2024-12-23T05:46:38Z",
  "interval": 5,
  "dataset": "realtime"
}

Similar queries