account balance with error

Returns DEX trades by token and balance updates on Solana, where account owner is HBV9sA…9Sw8 and DEX protocol family is Pumpfun, sorted by balance update post balance maximum, highest first: currency symbol, currency name, currency mint address, protocol family, protocol name, program address, sum of trade amount and 2 more fields.

By Nadia · 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}}}}
      )
    }
    balanceCurrent: BalanceUpdates(
      orderBy: {descendingByField: "BalanceUpdate_PostBalance_maximum"}
      where: {BalanceUpdate: {Currency: {Native: false}, Account: {Owner: {is: $account}}}}
    ) {
      BalanceUpdate {
        Currency {
          Symbol
          Name
          MintAddress
        }
        PostBalance(maximum: Block_Slot)
      }
    }
  }
}

Variables

{
  "account": "HBV9sARNHeCZcLpMZ7jt9hagjBoRPnuGPZPfdE249Sw8"
}

Similar queries