query for USDC

query

Returns the latest DEX trade by token on Solana, where currency mint address is EPjFWd…Dt1v, base currency mint address is EPjFWd…Dt1v and quote currency mint address is EPjFWd…Dt1v: currency name, currency symbol, decimals, URI, price in USD, sum of trade side amount in USD, market address and 7 more fields.

By Divyasshree · saved 16 May 2025 · Bitquery API v2

What it returns

Filters

The query

query ($token: String, $since: DateTime, $prev24h_start: DateTime, $prev24h_end: DateTime) {
  Solana(dataset: realtime) {
    latest: DEXTradeByTokens(
      where: {Trade: {Currency: {MintAddress: {is: $token}}}, Block: {Time: {since: $since}}}
      limit: {count: 1}
      orderBy: {descending: Block_Time}
    ) {
      Trade {
        Currency {
          Name
          Symbol
          Decimals
          Uri
        }
        PriceInUSD
      }
    }
    current_volume: DEXTradeByTokens(
      where: {Trade: {Currency: {MintAddress: {is: $token}}}, Block: {Time: {since: $since}}, Transaction: {Result: {Success: true}}}
    ) {
      total_volume: sum(of: Trade_Side_AmountInUSD)
    }
    previous_volume: DEXTradeByTokens(
      where: {Trade: {Currency: {MintAddress: {is: $token}}}, Block: {Time: {since: $prev24h_start, till: $prev24h_end}}, Transaction: {Result: {Success: true}}}
    ) {
      total_volume: sum(of: Trade_Side_AmountInUSD)
    }
    basePool: DEXPools(
      where: {Block: {Time: {since: $since}}, Transaction: {Result: {Success: true}}, Pool: {Market: {BaseCurrency: {MintAddress: {is: $token}}}}}
      limit: {count: 1}
    ) {
      Pool {
        Market {
          MarketAddress
          BaseCurrency {
            Name
          }
          QuoteCurrency {
            Name
          }
        }
        Base {
          PostAmount
          PostAmountInUSD(maximum: Block_Slot)
        }
        Quote {
          PostAmount
          PostAmountInUSD(maximum: Block_Slot)
        }
      }
    }
    quotePool: DEXPools(
      where: {Block: {Time: {since: $since}}, Transaction: {Result: {Success: true}}, Pool: {Market: {QuoteCurrency: {MintAddress: {is: $token}}}}}
      limit: {count: 1}
    ) {
      Pool {
        Market {
          MarketAddress
          BaseCurrency {
            Name
          }
          QuoteCurrency {
            Name
          }
        }
        Base {
          PostAmount
          PostAmountInUSD(maximum: Block_Slot)
        }
        Quote {
          PostAmount
          PostAmountInUSD(maximum: Block_Slot)
        }
      }
    }
    supply: TokenSupplyUpdates(
      where: {TokenSupplyUpdate: {Currency: {MintAddress: {is: $token}}}}
      limit: {count: 1}
      orderBy: {descending: Block_Time}
    ) {
      TokenSupplyUpdate {
        PostBalance
      }
    }
  }
}

Variables

{
  "token": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "since": "2025-05-12T16:48:25Z",
  "prev24h_start": "2025-05-11T16:48:25Z",
  "prev24h_end": "2025-05-12T16:48:25Z"
}

Similar queries