DEX Markets for a token

Returns DEX trades by token on Solana, where currency mint address is 59VxMU…fSHN, side currency mint address is So1111…1112 and block time after 2024-09-19, sorted by amount, highest first: protocol family, protocol name, price in USD, sum of trade side amount, unique of trade side currency mint address and count.

By Akshat · saved 19 September 2024 · run 62 times · Bitquery API v2

What it returns

Filters

The query

query ($token: String, $base: String, $time_10min_ago: DateTime, $time_1h_ago: DateTime, $time_3h_ago: DateTime) {
  Solana {
    DEXTradeByTokens(
      orderBy: {descendingByField: "amount"}
      where: {Trade: {Currency: {MintAddress: {is: $token}}, Side: {Amount: {gt: "0"}, Currency: {MintAddress: {is: $base}}}}, Transaction: {Result: {Success: true}}, Block: {Time: {after: $time_3h_ago}}}
    ) {
      Trade {
        Dex {
          ProtocolFamily
          ProtocolName
        }
        price_last: PriceInUSD(maximum: Block_Slot)
        price_10min_ago: PriceInUSD(
          maximum: Block_Slot
          if: {Block: {Time: {before: $time_10min_ago}}}
        )
        price_1h_ago: PriceInUSD(
          maximum: Block_Slot
          if: {Block: {Time: {before: $time_1h_ago}}}
        )
        price_3h_ago: PriceInUSD(minimum: Block_Slot)
      }
      amount: sum(of: Trade_Side_Amount)
      pairs: uniq(of: Trade_Side_Currency_MintAddress)
      trades: count
    }
  }
}

Variables

{
  "token": "59VxMU35CaHHBTndQQWDkChprM5FMw7YQi5aPE5rfSHN",
  "base": "So11111111111111111111111111111111111111112",
  "time_10min_ago": "2024-09-19T10:45:46Z",
  "time_1h_ago": "2024-09-19T09:55:46Z",
  "time_3h_ago": "2024-09-19T07:55:46Z"
}

Similar queries