BonkSwap API
In this document, we will explore several examples related to BonkSwap data.
Need zero-latency BonkSwap data? Read about our Shred Streams and Contact us for a Trial.
To query or stream data via graphQL outside the Bitquery IDE, you need to generate an API access token.
Follow the steps here to create one: How to generate Bitquery API token ➤
Table of Contents​
If you want fastest data without any latency, we can provide Kafka streams, please fill this form for it. Our Team will reach out.
BonkSwap Examples​
Latest Trades on BonkSwap​
This is a graphQL query that fetches latest swaps on BonkSwap, you can convert this to a stream by changing the word query
to subscription
.
query LatestTrades {
Solana {
DEXTradeByTokens(
orderBy: {descending: Block_Time}
limit: {count: 50}
where: {
Transaction: {Result: {Success: true}},
Trade: {Dex: {ProtocolName: {is: "bonkswap"}}}
}
) {
Block {
Time
}
Transaction {
Signature
}
Trade {
Dex {
ProtocolFamily
ProtocolName
}
Account {
Owner
}
Side {
Type
Account {
Address
Owner
}
}
AmountInUSD
PriceInUSD
Amount
Side {
Currency {
Symbol
MintAddress
Name
}
AmountInUSD
Amount
}
Currency {
Symbol
MintAddress
Name
}
}
}
}
}
Get Top Traders on BonkSwap​
The below API fetches top traders on BonkSwap using recent trading volume of the trader.
query TopTraders {
Solana {
DEXTradeByTokens(
orderBy: {descendingByField: "volumeUsd"}
limit: {count: 70}
where: {
Transaction: {Result: {Success: true}},
Trade: {Dex: {ProtocolName: {is: "bonkswap"}}},
Block: {Time: {after: "2025-06-10T09:07:39Z"}},
any: [
{Trade: {Side: {Currency: {MintAddress: {is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}}}},
{Trade: {
Currency: {MintAddress: {not: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}},
Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}
}},
{Trade: {
Currency: {MintAddress: {notIn: [
"So11111111111111111111111111111111111111112",
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
]}},
Side: {Currency: {MintAddress: {notIn: [
"So11111111111111111111111111111111111111112",
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
]}}}
}}
]
}
) {
Trade {
Account {
Owner
}
Dex {
ProtocolFamily
ProtocolName
}
Currency {
MintAddress
Symbol
Name
}
Side {
Currency {
MintAddress
Symbol
Name
}
}
}
volumeUsd: sum(of: Trade_Side_AmountInUSD)
}
}
}
Get Latest Trades By Trader on BonkSwap​
The below API fetches recent trades by a particular trader. We use the Transaction->Signer
field to set this criteria.
{
Solana(network: solana, dataset: realtime) {
DEXTrades(
orderBy: [{descending: Block_Time}, {descending: Transaction_Index}, {descending: Trade_Index}]
limit: {count: 10}
where: {Transaction: {Signer: {is: "EATeN8nptyVmydeDGD6966Sgw14BXdbLwxKXr19UH9q8"}}, Trade: {Dex: {ProtocolName: {is: "bonkswap"}}}}
) {
Block {
Time
}
Instruction {
Program {
Method
}
}
Trade {
Dex {
ProtocolFamily
ProtocolName
ProgramAddress
}
Buy {
Price
PriceInUSD
Amount
AmountInUSD
Account {
Address
Owner
}
Currency {
Name
Symbol
MintAddress
Decimals
Fungible
Uri
}
}
Sell {
Price
PriceInUSD
Amount
AmountInUSD
Account {
Owner
Address
}
Currency {
Name
Symbol
MintAddress
Decimals
Fungible
Uri
}
}
}
Transaction {
Signature
Signer
FeePayer
}
}
}
}
Get OHLC for a BonkSwap Token​
query MyQuery {
Solana {
DEXTradeByTokens(
where: {Trade: {Dex: {ProtocolName: {is: "bonkswap"}}, Currency: {MintAddress: {is: "token mint address"}}, Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}}, Transaction: {Result: {Success: true}}}
limit: {count: 100}
orderBy: {descendingByField: "Block_Timefield"}
){
Block{
Timefield: Time(interval:{count:1 in:minutes})
}
Trade{
open: Price(minimum:Block_Slot)
high: Price(maximum:Trade_Price)
low: Price(minimum:Trade_Price)
close: Price(maximum:Block_Slot)
}
volumeInUSD: sum(of:Trade_Side_AmountInUSD)
count
}
}
}