price calc sample

Returns the latest DEX trade by token on Solana, where side currency mint address is So1111…1112, currency mint address is 2zMMhc…uauv and block time after 2024-12-18: block time, transaction signature, market address, protocol name, protocol family, side type, price in USD and 6 more fields.

By Divyasshree · saved 18 December 2024 · run 1 time · Bitquery API v2

What it returns

Filters

The query

query LatestTrades($token: String, $base: String, $time_ago: DateTime) {
  Solana {
    DEXTradeByTokens(
      orderBy: {descending: Block_Time}
      limit: {count: 1}
      where: {Trade: {Side: {Amount: {gt: "0"}, Currency: {MintAddress: {is: $token}}}, Currency: {MintAddress: {is: $base}}}, Block: {Time: {after: $time_ago}}}
    ) {
      Block {
        allTime: Time
      }
      Transaction {
        Signature
      }
      Trade {
        Market {
          MarketAddress
        }
        Dex {
          ProtocolName
          ProtocolFamily
        }
        Side {
          Type
        }
        PriceInUSD
        Amount
        Side {
          Currency {
            Symbol
            MintAddress
            Name
          }
          AmountInUSD
          Amount
        }
      }
    }
  }
}

Variables

{
  "base": "2zMMhcVQEXDtdE6vsFS7S7D5oUodfJHE8vd1gnBouauv",
  "token": "So11111111111111111111111111111111111111112",
  "time_ago": "2024-12-18T04:39:50Z"
}

Similar queries