Trades of wallets with balance Updates in that trades

Trades made by the wallets in `addressList`, with the balance updates from those same transactions joined on. Uses `DEXTradeByTokens` rather than `Solana.DEXTrades`: DEXTrades keeps only about 12 hours on Solana and has no archive, so the previous version returned no rows whenever the wallet had not traded in the last half day. DEXTradeByTokens keeps about 7 days and supports `archive` for older windows.

By gaurav · saved 23 June 2025 · run 8 times · Bitquery API v2

What it returns

The query

query MyQuery($addressList: [String!]) {
  Solana {
    DEXTradeByTokens(
      limit: { count: 10 }
      orderBy: { descending: Block_Time }
      where: {
        Transaction: { Result: { Success: true } }
        any: [
          { Trade: { Account: { Address: { in: $addressList } } } }
          { Trade: { Account: { Token: { Owner: { in: $addressList } } } } }
          { Transaction: { Signer: { in: $addressList } } }
        ]
      }
    ) {
      Block { Time }
      Trade {
        Amount
        AmountInUSD
        Currency { Name Symbol MintAddress Decimals }
        Side {
          Amount
          AmountInUSD
          Currency { Name Symbol MintAddress Decimals }
        }
      }
      Transaction { Signature Signer }
      joinBalanceUpdates(join: left, Transaction_Signature: Transaction_Signature) {
        Block { Time }
        BalanceUpdate {
          PreBalance
          PostBalance
          Account { Address Token { Owner } }
        }
      }
    }
  }
}

Variables

{
  "addressList": [
    "GHigB15jr7wZ8GitjD4Hf5naqyUJfMbKa1n1PmSiBhUc"
  ]
}

Similar queries