account dex trades with error

Returns DEX trades by token on Solana, where DEX protocol family is Pumpfun, sorted by USD bought, highest first: currency symbol, currency name, currency mint address, protocol family, protocol name, program address, sum of trade amount and sum of trade side amount in USD.

By Aleksey · saved 8 August 2024 · run 4 times · Bitquery API v2

What it returns

Filters

The query

query listOfTokensTraded($account: String) {
  Solana {
    DEXTradeByTokens(
      orderBy: {descendingByField: "usdBought"}
      where: {any: [{Trade: {Account: {Owner: {is: $account}}}}, {Trade: {Side: {Account: {Address: {is: $account}}}}}], Trade: {Currency: {Native: false}, Dex: {ProtocolFamily: {is: "Pumpfun"}}}, Transaction: {Result: {Success: true}}}
    ) {
      Trade {
        Currency {
          Symbol
          Name
          MintAddress
        }
        Dex {
          ProtocolFamily
          ProtocolName
          ProgramAddress
        }
      }
      amountBought: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: buy}}}})
      amountSold: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: sell}}}})
      usdBought: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: buy}}}}
      )
      usdSold: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: sell}}}}
      )
    }
  }
}

Variables

{
  "account": "HBV9sARNHeCZcLpMZ7jt9hagjBoRPnuGPZPfdE249Sw8"
}

Similar queries