Skip to main content

Photon Solana API

Photon is a routing aggregator on Solana that finds the best execution paths across multiple DEXs. To identify trades that were routed through Photon, we use their program address BSfD6SHZigAfDWSjzD5Q41jw8LmKwtmjskPH9XW1mrRW in our queries.

This program address appears in the instruction data when Photon routes a trade, allowing us to filter and analyze only the trades that went through their routing system. By joining DEX trade data with instruction data containing this program address, we can accurately track Photon's routing activity and provide insights into their trade execution patterns.

note

Trade Side Account field will not be available for aggregate queries in Archive and Combined Datasets

Latest Trades Routed via Photon​

This query retrieves the latest 100 trades that were routed through Photon on Solana. The query uses a joinInstructions function to filter trades that specifically involved Photon's routing program (address: BSfD6SHZigAfDWSjzD5Q41jw8LmKwtmjskPH9XW1mrRW). For more information about using joins in Bitquery APIs, see our graphQL joins documentation.

Run Query

{
Solana {
DEXTrades(limit: {count: 100}, orderBy: {descending: Block_Time}) {
Trade {
Dex {
ProtocolName
}
Sell {
Currency {
Symbol
}
Amount
AmountInUSD
Account {
Address
}
Price
PriceInUSD
}
Buy {
Currency {
Symbol
}
Amount
AmountInUSD
Account {
Address
}
Price
PriceInUSD
}
}
Transaction {
Signature
}
Instruction {
ExternalSeqNumber
InternalSeqNumber
}
joinInstructions(
join: inner
Block_Slot: Block_Slot
Transaction_Signature: Transaction_Signature
where: {Instruction: {Program: {Address: {is: "BSfD6SHZigAfDWSjzD5Q41jw8LmKwtmjskPH9XW1mrRW"}}}}
) {
Instruction {
Program {
Address
}
}
Transaction {
Signature
}
}
}
}
}


Get Trade Transactions Of Photon For A Particular Pair​

The query will get latest trades for a Solana pair executed via Photon You can find the query here

{
Solana {
DEXTrades(
limit: {count: 100}
orderBy: {descending: Block_Time}
where: {Trade: {Market:{MarketAddress:{is:"FsKeY7bWnGL3ucTVfWWWJZyGCqr1VGXbKVZWteUHPYzX"}}}}
) {
Trade {
Dex {
ProtocolName
}
Sell {
Currency {
Symbol
}
Amount
AmountInUSD
Account {
Address
}
Price
PriceInUSD
}
Buy {
Currency {
Symbol
}
Amount
AmountInUSD
Account {
Address
}
Price
PriceInUSD
}
Market {
MarketAddress
}
}
Transaction {
Signature
}
Instruction {
ExternalSeqNumber
InternalSeqNumber
}
joinInstructions(
join: inner
Block_Slot: Block_Slot
Transaction_Signature: Transaction_Signature
where: {Instruction: {Program: {Address: {is: "BSfD6SHZigAfDWSjzD5Q41jw8LmKwtmjskPH9XW1mrRW"}}}}
) {
Instruction {
Program {
Address
}
}
Transaction {
Signature
}
}
}
}
}