snapx solana archive time sample

Returns DEX trades by token on Solana, where market market address is Cj2sBc…qnn6: currency name, currency mint address, currency symbol, price in USD, protocol name, protocol family, program address and 6 more fields.

By Divyasshree · saved 1 November 2024 · run 3 times · Bitquery API v2

What it returns

Filters

The query

query MyQuery($market_address: String, $h24_time: DateTime) {
  Solana(dataset: archive) {
    DEXTradeByTokens(
      where: {Transaction: {Result: {Success: true}}, Trade: {Market: {MarketAddress: {is: $market_address}}}}
    ) {
      Trade {
        Currency {
          Name
          MintAddress
          Symbol
        }
        start: PriceInUSD(minimum: Block_Time)
        h24: PriceInUSD(minimum: Block_Time, if: {Block: {Time: {after: $h24_time}}})
        end: PriceInUSD(maximum: Block_Time)
        Dex {
          ProtocolName
          ProtocolFamily
          ProgramAddress
        }
        Market {
          MarketAddress
        }
        Side {
          Currency {
            Symbol
            Name
            MintAddress
          }
        }
      }
      buyers_count: count(
        distinct: Trade_Account_Address
        if: {Trade: {Side: {Type: {is: buy}}}}
      )
      buyers_count_24h: count(
        distinct: Trade_Account_Address
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: $h24_time}}}
      )
      sellers_count: count(
        distinct: Trade_Side_Account_Address
        if: {Trade: {Side: {Type: {is: sell}}}}
      )
      sellers_count_24h: count(
        distinct: Trade_Side_Account_Address
        if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after: $h24_time}}}
      )
      trades_count: count
      trades_count_24h: count(if: {Block: {Time: {after: $h24_time}}})
      traded_volume_usd: sum(of: Trade_Side_AmountInUSD)
      traded_volume_usd_24h: sum(
        of: Trade_Side_AmountInUSD
        if: {Block: {Time: {after: $h24_time}}}
      )
      buy_volume_usd: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: buy}}}}
      )
      buy_volume_usd_24h: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: $h24_time}}}
      )
      sell_volume_usd: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: sell}}}}
      )
      sell_volume_usd_24h: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after: $h24_time}}}
      )
      buys_count: count(if: {Trade: {Side: {Type: {is: buy}}}})
      buys_count_24h: count(
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: $h24_time}}}
      )
      sells_count_total: count(if: {Trade: {Side: {Type: {is: sell}}}})
      sells_count_24h: count(
        if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after: $h24_time}}}
      )
    }
  }
}

Variables

{
  "market_address": "Cj2sBccxY2Sn4pnjUHfDe4ZkqKPmhwpmfSWstuQuqnn6",
  "h24_time": "2024-11-01T14:08:00Z"
}

Similar queries