myown

Trying new things

Streams DEX trades by token on Tron as they happen, 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, price in USD, quantile of trade price in USD and sum of trade price in USD.

By Lisa Wall · saved 26 December 2024 · Bitquery API v2

What it returns

Filters

The subscription

subscription TokenOHLC($token: String, $time_ago: DateTime) {
  Tron {
    DEXTradeByTokens(
      orderBy: {ascendingByField: "Block_Time"}
      where: {Trade: {Amount: {gt: "0"}, Currency: {SmartContract: {is: $token}}}, Transaction: {Result: {Success: true}, Fee: {}}, Block: {Time: {since: $time_ago}}}
    ) {
      Block {
        Time
      }
      Trade {
        close: PriceInUSD(maximum: Trade_PriceInUSD)
      }
      min: quantile(of: Trade_PriceInUSD, level: 0.05)
      max: quantile(of: Trade_PriceInUSD, level: 0.95)
      volume: sum(of: Trade_PriceInUSD, selectWhere: {})
    }
  }
}

Variables

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

Similar queries