Buys, Sells, BuyVolume, SellVolume, Makers, TotalTradedVolume, PriceinUSD for solana token pair

Returns DEX trades by token on Solana, where currency mint address is Df6yfr…pump, side currency mint address is So1111…1112 and market market address is 93tjgw…Z7bu: currency name, currency mint address, currency symbol, price in USD, protocol name, protocol family, program address and 6 more fields.

By Akshat · saved 25 December 2024 · run 3 times · Bitquery API v2

What it returns

Filters

The query

query MyQuery($token: String!, $side_token: String!, $pair_address: String!, $time_5min_ago: DateTime!, $time_1h_ago: DateTime!, $time_6h_ago: DateTime!, $time_24h_ago: DateTime! ) {
  Solana(dataset: combined) {
    DEXTradeByTokens(
      where: {Transaction: {Result: {Success: true}}, Trade: {Currency: {MintAddress: {is: $token}}, Side: {Currency: {MintAddress: {is: $side_token}}}, Market: {MarketAddress: {is: $pair_address}}}, Block: {Time: {since: $time_24h_ago}}}
    ) {
      Trade {
        Currency {
          Name
          MintAddress
          Symbol
        }
        hour24_price: PriceInUSD(minimum: Block_Time)
        min5_price: PriceInUSD(
          minimum: Block_Time
          if: {Block: {Time: {after: $time_5min_ago}}}
        )
        hour1_price: PriceInUSD(
          minimum: Block_Time
          if: {Block: {Time: {after: $time_1h_ago}}}
        )
        hour6_price: PriceInUSD(
          minimum: Block_Time
          if: {Block: {Time: {after: $time_6h_ago}}}
        )
        current_price: PriceInUSD(maximum: Block_Time)
        Dex {
          ProtocolName
          ProtocolFamily
          ProgramAddress
        }
        Market {
          MarketAddress
        }
        Side {
          Currency {
            Symbol
            Name
            MintAddress
          }
        }
      }
      trades_24h: count
      trades_5min: count(if: {Block: {Time: {after: $time_5min_ago}}})
      trades_1h: count(if: {Block: {Time: {after: $time_1h_ago}}})
      trades_6h: count(if: {Block: {Time: {after: $time_6h_ago}}})
      traded_volume_24h: sum(of: Trade_Side_AmountInUSD)
      traded_volume_5min: sum(
        of: Trade_Side_AmountInUSD
        if: {Block: {Time: {after: $time_5min_ago}}}
      )
      traded_volume_1h: sum(
        of: Trade_Side_AmountInUSD
        if: {Block: {Time: {after: $time_1h_ago}}}
      )
      traded_volume_6h: sum(
        of: Trade_Side_AmountInUSD
        if: {Block: {Time: {after: $time_6h_ago}}}
      )
      buy_volume_24h: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: buy}}}}
      )
      buy_volume_5min: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: $time_5min_ago}}}
      )
      buy_volume_1h: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: $time_1h_ago}}}
      )
      buy_volume_6h: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: $time_6h_ago}}}
      )
      sell_volume_24h: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: sell}}}}
      )
      sell_volume_5min: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after: $time_5min_ago}}}
      )
      sell_volume_1h: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after: $time_1h_ago}}}
      )
      sell_volume_6h: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after: $time_6h_ago}}}
      )
      buys_24h: count(if: {Trade: {Side: {Type: {is: buy}}}})
      buys_5min: count(
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: $time_5min_ago}}}
      )
      buys_1h: count(
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: $time_1h_ago}}}
      )
      buys_6h: count(
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: $time_6h_ago}}}
      )
      sells_24h: count(if: {Trade: {Side: {Type: {is: sell}}}})
      sells_5min: count(
        if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after: $time_5min_ago}}}
      )
      sells_1h: count(
        if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after: $time_1h_ago}}}
      )
      sells_6h: count(
        if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after: $time_6h_ago}}}
      )
    }
  }
}

Variables

{
  "token":"Df6yfrKC8kZE3KNkrHERKzAetSxbrWeniQfyJY4Jpump",
  "side_token": "So11111111111111111111111111111111111111112",
  "pair_address": "93tjgwff5Ac5ThyMi8C4WejVVQq4tuMeMuYW1LEYZ7bu",
  "time_5min_ago":"2024-12-25T08:15:00Z",
  "time_1h_ago":"2024-12-25T07:20:00Z",
  "time_6h_ago":"2024-12-25T02:20:00Z",
  "time_24h_ago": "2024-12-24T08:20:00Z"
}

Similar queries