dex trades by market

Returns 200 DEX trades by token on TON, where DEX protocol family is StonFi and block time after 2024-10-19, sorted by USD, highest first: protocol name, protocol family, currency symbol, currency name, smart contract address, workchain, fungible and 8 more fields.

By Srdjan Stankovic · saved 22 October 2024 · run 4 times · Bitquery API v2

What it returns

Filters

The query

query ($market: String, $time_10min_ago: DateTime, $time_1h_ago: DateTime, $time_3h_ago: DateTime, $time_ago: DateTime) {
  Ton {
    DEXTradeByTokens(
      orderBy: {descendingByField: "usd"}
      where: {Trade: {Success: true, Dex: {ProtocolFamily: {is: $market}}}, Block: {Time: {after: $time_ago}}}
      limit: {count: 200}
    ) {
      Trade {
        Dex {
          ProtocolName
          ProtocolFamily
        }
        Currency {
          Symbol
          Name
          SmartContract {
            Address
            Workchain
          }
          Fungible
        }
        Side {
          Currency {
            Symbol
            Name
            SmartContract {
              Address
              Workchain
            }
          }
        }
        price_usd: PriceInUSD(maximum: Block_Number)
        price_last: Price(maximum: Block_Number)
        price_10min_ago: Price(
          maximum: Block_Number
          if: {Block: {Time: {before: $time_10min_ago}}}
        )
        price_1h_ago: Price(
          maximum: Block_Number
          if: {Block: {Time: {before: $time_1h_ago}}}
        )
        price_3h_ago: Price(
          maximum: Block_Number
          if: {Block: {Time: {before: $time_3h_ago}}}
        )
      }
      usd: sum(of: Trade_AmountInUSD)
      count
    }
  }
}

Variables

{
  "market": "StonFi",
  "time_10min_ago": "2024-10-22T11:32:21Z",
  "time_1h_ago": "2024-10-22T10:42:21Z",
  "time_3h_ago": "2024-10-22T08:42:21Z",
  "time_ago": "2024-10-19T11:42:21Z",
  "usdc": "EQB-MPwrd1G6WKNkLz_VnV6WqBDd142KMQv-g1O-8QUA3728",
  "usdt": "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs",
  "pton": "EQAyvcnP0RexLvnsQMXfKYnk18Bzl3Y-iGt6bXqFB75ugXmE",
  "min_count": "10"
}

Similar queries