Solana Trader API
In this section we will see how to get Solana trader information using our API. More queries on DEX trades including latest trades, OHLC, and other data points can be found in the Solana DEX Trades API page.
Trade Side Account field will not be available for aggregate queries in Archive and Combined Datasets
Top Traders of a token
This query returns the top traders for a specific token by USD volume over a date range. It uses the combined dataset and filters by token mint, quote currency (e.g. SOL), and optional date range. For each trader you get buy/sell counts, buy/sell volume, total volume, and trade count.
{
Solana(dataset: combined) {
DEXTradeByTokens(
where: {
Trade: {
Currency: { MintAddress: { is: "98sMhvDwXj1RQi5c5Mndm3vPe9cBqPrbLaufMXFNMh5g" } }
Side: { Currency: { MintAddress: { is: "So11111111111111111111111111111111111111112" } } }
}
Transaction: { Result: { Success: true } }
Block: { Date: { since: "2026-01-01", till: "2026-01-02" } }
}
orderBy: { descendingByField: "volume" }
limit: { count: 100 }
) {
Trade {
Currency {
Name
Symbol
MintAddress
}
Account {
Owner
}
}
buys: count(if: { Trade: { Side: { Type: { is: buy } } } })
sells: count(if: { Trade: { Side: { Type: { is: sell } } } })
buy_volume: sum(
of: Trade_Side_AmountInUSD
if: { Trade: { Side: { Type: { is: buy } } } }
)
sell_volume: sum(
of: Trade_Side_AmountInUSD
if: { Trade: { Side: { Type: { is: sell } } } }
)
volume: sum(of: Trade_Side_AmountInUSD)
trades: count
}
}
}
Change the token mint (Trade.Currency.MintAddress), quote currency (Trade.Side.Currency.MintAddress), and Block.Date.since / till to match your token and time window.
Trades of Wallets in Realtime
Below query will give you the trades of the wallets present in addressList in realtime. Try the query here.
subscription MyQuery($addressList: [String!]) {
Solana {
DEXTrades(
where: {Transaction: {Result: {Success: true}}, any: [{Trade: {Buy: {Account: {Address: {in: $addressList}}}}}, {Trade: {Buy: {Account: {Token: {Owner: {in: $addressList}}}}}}, {Trade: {Sell: {Account: {Address: {in: $addressList}}}}}, {Trade: {Sell: {Account: {Token: {Owner: {in: $addressList}}}}}}]}
) {
Instruction {
Program {
Method
}
}
Block {
Time
}
Trade {
Buy {
Amount
Account {
Address
}
Currency {
Name
Symbol
MintAddress
Decimals
}
AmountInUSD
}
Sell {
Amount
Account {
Address
}
Currency {
Name
Symbol
MintAddress
Decimals
}
AmountInUSD
}
}
Transaction {
Signature
Signer
}
}
}
}
{
"addressList": ["7eWHXZefGY98o9grrrt1Z3j7DcPDEhA4UviQ1pVNhTXX", "6LNdbvyb11JH8qxAsJoPSfkwK4zJDQKQ6LNp4mxt8VpR"]
}
Trades of Wallets with PreBalance, PostBalance
Below query will give you the trades of the wallets present in addressList along with the balance updates happened in those trades.. Try the query here.
query MyQuery($addressList: [String!]) {
Solana {
DEXTrades(
limit: {count: 10}
orderBy: {descending: Block_Time}
where: {Transaction: {Result: {Success: true}}, any: [{Trade: {Buy: {Account: {Address: {in: $addressList}}}}}, {Trade: {Buy: {Account: {Token: {Owner: {in: $addressList}}}}}}, {Trade: {Sell: {Account: {Address: {in: $addressList}}}}}, {Trade: {Sell: {Account: {Token: {Owner: {in: $addressList}}}}}}]}
) {
Instruction {
Program {
Method
}
}
Block {
Time
}
Trade {
Buy {
Amount
Account {
Address
}
Currency {
Name
Symbol
MintAddress
Decimals
}
AmountInUSD
}
Sell {
Amount
Account {
Address
}
Currency {
Name
Symbol
MintAddress
Decimals
}
AmountInUSD
}
}
Transaction {
Signature
Signer
}
joinBalanceUpdates(join: left, Transaction_Signature: Transaction_Signature) {
Block{
Time
}
BalanceUpdate {
PreBalance
PostBalance
Account {
Address
Token {
Owner
}
}
}
}
}
}
}
{
"addressList": ["HevtGooXxDjLfvLM1vUY2y7b9gyu59whR4ycnQj3UjUT"]
}
Get count of Buys and Sells of a Trader
To get the count of Buys and Sells of a specific trader after a certain timestamp, use the following query.
Find the query here
query MyQuery($timestamp: DateTime, $trader: String) {
Solana(dataset: combined) {
DEXTradeByTokens(
where: {Block: {Time: {since: $timestamp}}, Trade: {Side: {Currency: {MintAddress: {in: ["So11111111111111111111111111111111111111112", "11111111111111111111111111111111"]}}}}, any: [{Trade: {Account: {Address: {is: $trader}}}}, {Trade: {Account: {Token: {Owner: {is: $trader}}}}}]}
) {
buys: count(if: {Trade: {Side: {Type: {is: buy}}}})
sells: count(if: {Trade: {Side: {Type: {is: sell}}}})
}
}
}
{
"timestamp" : "2024-06-25T06:19:00Z",
"trader" : "FeWbDQ9SpgWS8grNrpFesVquJfxVkRu1WNZerKsrkcbY"
}
Total Bought, Total Sold, Avg Sell price, Last Active Trade of a specific token by an Address
Get total bought, total sold, average sell price, and last active trade time for a specific token by a trader. Test the query here
query MyQuery ($trader:String, $token:String){
Solana(dataset: realtime) {
DEXTradeByTokens(
where: { Trade: {Currency:{MintAddress:{is:$token}} Side: {Currency: {MintAddress: {in: ["So11111111111111111111111111111111111111112", "11111111111111111111111111111111"]}}}}, any: [{Trade: {Account: {Address: {is: $trader}}}}, {Trade: {Account: {Token: {Owner: {is: $trader}}}}}]}
) {
Block{
last_active_time:Time(maximum:Block_Time)
}
total_buy: sum(of:Trade_Side_AmountInUSD if: {Trade: {Side: {Type: {is: buy}}}})
total_sell: sum(of:Trade_Side_AmountInUSD if: {Trade: {Side: {Type: {is: sell}}}})
avg_sell_price: average(of:Trade_PriceInUSD if: {Trade: {Side: {Type: {is: sell}}}})
}
}
}
{
"token":"FSJYiGZhJ1wDPNhHbSHm49yJkzbFp7FykNB2SZFipump",
"trader": "CECN4BW4DKnbyddkd9FhWVR5dotzKhQr5p7DUPhQ55Du"
}
Subscribe to a Trader in Real-time
The below subscription query will fetch in real-time the trades done by a wallet. You can use websockets to build applications on this data. Read more here
To filter trades by a wallet we will use the condition Account: {Address: {is}}. Run the subscription query here
You can convert this subscription to a query to get past trades of the wallet.
subscription {
Solana {
buy: DEXTrades(
where: {Trade: {Buy: {Account: {Address: {is: "CP1d7VVnCMy321G6Q1924Bibp528rqibTX8x9UL6wUCe"}}}}}
) {
Trade {
Dex {
ProgramAddress
ProtocolFamily
ProtocolName
}
Buy {
Amount
Account {
Address
}
Currency {
MetadataAddress
Key
IsMutable
EditionNonce
Decimals
CollectionAddress
Fungible
Symbol
Native
Name
}
Order {
LimitPrice
LimitAmount
OrderId
}
Price
}
Market {
MarketAddress
}
Sell {
Account {
Address
}
Currency {
IsMutable
Decimals
CollectionAddress
Fungible
Symbol
Native
Name
}
Price
}
}
}
sell: DEXTrades(
where: {Trade: {Sell: {Account: {Address: {is: "CP1d7VVnCMy321G6Q1924Bibp528rqibTX8x9UL6wUCe"}}}}}
) {
Trade {
Dex {
ProgramAddress
ProtocolFamily
ProtocolName
}
Buy {
Amount
Account {
Address
}
Currency {
MetadataAddress
Key
IsMutable
EditionNonce
Decimals
CollectionAddress
Fungible
Symbol
Native
Name
}
Order {
LimitPrice
LimitAmount
OrderId
}
Price
}
Market {
MarketAddress
}
Sell {
Account {
Address
}
Currency {
IsMutable
Decimals
CollectionAddress
Fungible
Symbol
Native
Name
}
Price
}
}
}
}
}
Get the First 100 buyers of a Token
The below query retrieves the first 100 buyers of a specified token. You can run the query here
query MyQuery {
Solana {
DEXTrades(
where: {
Trade: {
Buy: {
Currency: {
MintAddress: {
is: "2Z4FzKBcw48KBD2PaR4wtxo4sYGbS7QqTQCLoQnUpump"
}
}
}
}
}
limit: { count: 100 }
orderBy: { ascending: Block_Time }
) {
Trade {
Buy {
Amount
Account {
Token {
Owner
}
}
}
}
}
}
}