Token trades by address

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 9 July 2024 · run 3 times · Bitquery API v2

What it returns

Filters

The query

query TopTraders($address: String) {
  Solana {
    DEXTradeByTokens(
      orderBy: {descendingByField: "usdBought"}
      where: {any: [
              {Trade: {Account: {Token: {Owner: {is: $address}}}}}, 
              {Trade: {Side: {Account: {Address: {is: $address}}}}}
            ], 
        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

{
  "address": "8hebxw1nfXqdsLqbcHsX8ragfDWD41WNFv5kVGgiviD2"
}

Similar queries