tokens owned by an address

Returns the latest 100 DEX trades by token and DEX trades on Solana, where currency mint address is FQ1tys…21p8, side currency mint address is So1111…1112 and buy currency mint address is FQ1tys…21p8: account owner, program address, protocol family, protocol name, sum of trade amount, sum of trade side amount, count and 2 more fields.

By Name · saved 19 November 2024 · run 18 times · Bitquery API v2

What it returns

Filters

The query

query TopTraders($token: String, $base: String) {
  Solana {
    DEXTradeByTokens(
      orderBy: {descendingByField: "volume"}
      limit: {count: 100}
      where: {Trade: {Currency: {MintAddress: {is: $token}}, Side: {Amount: {gt: "0"}, Currency: {MintAddress: {is: $base}}, Type: {}}}, Transaction: {Result: {Success: true}}}
    ) {
      Trade {
        Account {
          Owner
        }
        Dex {
          ProgramAddress
          ProtocolFamily
          ProtocolName
        }
      }
      boughtTokens: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: buy}}}})
      boughtTokensInWsol: sum(of: Trade_Side_Amount, if: {Trade: {Side: {Type: {is: buy}}}})
      boughtTimes: count(if: {Trade: {Side: {Type: {is: buy}}}})
      soldTokens: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: sell}}}})
      soldTokensInWsol: sum(of: Trade_Side_Amount, if: {Trade: {Side: {Type: {is: sell}}}})
      soldTimes: count(if: {Trade: {Side: {Type: {is: sell}}}})
      volume: sum(of: Trade_Amount)
    }
    DEXTrades(
      limitBy: {count: 1, by: Trade_Buy_Currency_MintAddress}
      orderBy: {descending: Block_Time}
      where: {Trade: {Buy: {Currency: {MintAddress: {is: $token}}}}, Transaction: {Result: {Success: true}}}
    ) {
      Trade {
        Buy {
          Currency {
            MintAddress
          }
          currentPriceTokenInWsol: Price(selectWhere: {gt: 0})
        }
      }
    }
  }
}

Variables

{
  "token": "FQ1tyso61AH1tzodyJfSwmzsD3GToybbRNoZxUBz21p8",
  "base": "So11111111111111111111111111111111111111112"
}

Similar queries