DEXScreener Solana Data
This section will guide you through different APIs which will tell you how to get data like realtime trades just like how DEXScreener shows for Solana.
Get Trade Transactions for a particular pair in realtime​
The query will subscribe you to real-time trade transactions for a Solana pair, providing a continuous stream of data as new trades are processed and recorded. You can find the query here
subscription MyQuery {
Solana {
DEXTradeByTokens(
where: {Trade: {Currency: {MintAddress: {is: "3B5wuUrMEi5yATD7on46hKfej3pfmd7t1RKgrsN3pump"}}, Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}, Dex: {ProgramAddress: {is: "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"}}}, Transaction: {Result: {Success: true}}}
) {
Block {
Time
}
Trade {
Currency {
Name
Symbol
}
Amount
PriceAgainstSideCurrency: Price
PriceInUSD
Side {
Currency {
Name
Symbol
}
Amount
Type
}
}
Transaction {
Maker: Signer
Signature
}
}
}
}
Get Top Pairs on Solana​
The query will give the top 10 pairs on Solana network in descending order of their total trades happened in their pools in last 1 hour. This query will get you all the data you need such as total trades, total buys, total sells, total traded volume, total buy volume
Please change the Block: {Time: {since: "2024-08-15T04:19:00Z"}}
accordingly when you try out the query.
Keep in mind you cannot use this as a websocket subscription becuase aggregate functions like sum
doesn't work well in subscription
.
You can find the query here
query MyQuery {
Solana {
DEXTradeByTokens(
where: {Transaction: {Result: {Success: true}}, Trade: {Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}}, Block: {Time: {since: "2024-08-15T04:19:00Z"}}}
orderBy: {descendingByField: "total_trades"}
limit: {count: 10}
) {
Trade {
Currency {
Name
MintAddress
Symbol
}
start: PriceInUSD(minimum: Block_Time)
min5: PriceInUSD(
minimum: Block_Time
if: {Block: {Time: {after: "2024-08-15T05:14:00Z"}}}
)
end: PriceInUSD(maximum: Block_Time)
Dex {
ProtocolName
ProtocolFamily
ProgramAddress
}
Market {
MarketAddress
}
Side {
Currency {
Symbol
Name
MintAddress
}
}
}
makers: count(distinct:Transaction_Signer)
total_trades: count
total_traded_volume: sum(of: Trade_Side_AmountInUSD)
total_buy_volume: sum(
of: Trade_Side_AmountInUSD
if: {Trade: {Side: {Type: {is: buy}}}}
)
total_sell_volume: sum(
of: Trade_Side_AmountInUSD
if: {Trade: {Side: {Type: {is: sell}}}}
)
total_buys: count(if: {Trade: {Side: {Type: {is: buy}}}})
total_sells: count(if: {Trade: {Side: {Type: {is: sell}}}})
}
}
}