SolFi DEX API
For real-time + last ~30 days, use the Trading cube. Trading.Trades gives you clean, MEV-filtered SolFi swaps with USD price, market cap, and supply on every row across 10 chains in one API. Use this page when you need historical SolFi data older than ~30 days, raw per-swap detail, or call / event context.
SolFi Trades in Real-Time
This streams a message for every new SolFi trade, carrying the buy and sell sides, the block and the transaction. Open it in the Bitquery IDE: realtime SolFi trades.
subscription {
Solana {
DEXTrades(where: { Trade: { Dex: { ProtocolFamily: { is: "Solfi" } } } }) {
Trade {
Dex {
ProgramAddress
ProtocolFamily
ProtocolName
}
Buy {
Currency {
Name
Symbol
MintAddress
}
Amount
Account {
Address
}
PriceAgainstSellCurrency: Price
}
Sell {
Account {
Address
}
Amount
Currency {
Name
Symbol
MintAddress
}
PriceAgainstBuyCurrency: Price
}
}
Block {
Time
}
}
}
}
Latest Price of a Token on SolFi
This returns the most recent trade for a token on SolFi, with the price in the quote token and in USD.
Open it in the Bitquery IDE: latest SolFi token price.
{
Solana {
DEXTradeByTokens(
limit: {count: 1}
orderBy: {descending: Block_Time}
where: {Trade: {Dex: {ProtocolFamily: {is: "Solfi"}}, Currency: {MintAddress: {is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}, Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}}}
) {
Block {
Time
}
Trade {
Price
PriceInUSD
}
}
}
}
Realtime Price feed of a Token on SolFi
The same filter as a subscription pushes a message on every new trade, giving a live price feed instead of a single reading.
Open it in the Bitquery IDE: SolFi realtime price feed.
subscription{
Solana {
DEXTradeByTokens(
where: {Trade: {Dex: {ProtocolFamily: {is: "Solfi"}}, Currency: {MintAddress: {is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}}}
) {
Block {
Time
}
Trade {
Price
PriceInUSD
}
}
}
}
SolFi OHLC API
If you want to get OHLC data for any specific currency pair on SolFi, you can use this api. Only use this API as query and not subscription websocket as Aggregates and Time Intervals don't work well with subscriptions.
{
Solana {
DEXTradeByTokens(
orderBy: {descendingByField: "Block_Timefield"}
where: {Trade: {Currency: {MintAddress: {is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}, Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}, Dex: {ProtocolFamily: {is: "Solfi"}}, PriceAsymmetry: {lt: 0.1}}}
limit: {count: 10}
) {
Block {
Timefield: Time(interval: {in: minutes, count: 1})
}
volume: sum(of: Trade_Amount)
Trade {
high: Price(maximum: Trade_Price)
low: Price(minimum: Trade_Price)
open: Price(minimum: Block_Slot)
close: Price(maximum: Block_Slot)
}
count
}
}
}
Get the Top Traders of a specific Token on SolFi DEX
This ranks the wallets trading a given token on SolFi, here USDC (EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v). Run it as a plain request, not a WebSocket subscription: aggregates are recomputed per message on a subscription, so the totals come back wrong. Open it in the Bitquery IDE: SolFi top traders.
query TopTraders($token: String) {
Solana {
DEXTradeByTokens(
orderBy: {descendingByField: "volumeUsd"}
limit: {count: 100}
where: {Trade: {Currency: {MintAddress: {is: $token}}, Dex: {ProtocolFamily: {is: "Solfi"}}}, Transaction: {Result: {Success: true}}}
) {
Trade {
Account {
Owner
}
Side {
Account {
Address
}
Type
}
}
bought: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: buy}}}})
sold: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: sell}}}})
volume: sum(of: Trade_Amount)
volumeUsd: sum(of: Trade_Side_AmountInUSD)
}
}
}
{
"token": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
}
Get trading volume, buy volume, sell volume of a token
This reads the Trading cube rather than the chain-level DEXTradeByTokens. Every Trading row carries a vetted USD price and the cube covers roughly the last 30 days in full, while the Solana archive and combined datasets return about a fifth fewer trades than realtime over the same window, so volume totals taken from them read low.
Side is the trader's own side. The example follows the WSOL/USDC market on SolFi; swap the two addresses for the pair you want, and widen days_ago up to the 30-day window. For longer spans use Trading.Pairs with sum(of: Volume_Usd) over hourly intervals, which is pre-aggregated and far cheaper than scanning every trade.
Open it in the Bitquery IDE: SolFi trade volume.
{
Trading {
Trades(
where: {
Pair: {
Market: { ProtocolFamily: { is: "Solfi" }, Network: { is: "Solana" } }
Token: { Address: { is: "So11111111111111111111111111111111111111112" } }
QuoteToken: {
Address: { is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" }
}
}
Block: { Time: { since_relative: { days_ago: 7 } } }
}
) {
volumeUsd: sum(of: AmountsInUsd_Base)
buy_volume: sum(of: AmountsInUsd_Base, if: { Side: { is: "Buy" } })
sell_volume: sum(of: AmountsInUsd_Base, if: { Side: { is: "Sell" } })
buys: count(if: { Side: { is: "Buy" } })
sells: count(if: { Side: { is: "Sell" } })
}
}
}
Volatility of a Pair on SolFi
Volatility is an important factor in trading world as it determines the fluctuation in price that implies the possibility of profit and risk of loss. Lesser volatility denotes that the pair is stable.
Here is the query to get the volatility for a selected pair in the last 1 hour.
query Volatility {
Solana(dataset: realtime) {
DEXTrades(
where: {
Trade: {
Dex: { ProtocolFamily: { is: "Solfi" } }
Buy: {
Currency: {
MintAddress: { is: "So11111111111111111111111111111111111111112" }
}
}
Sell: {
Currency: {
MintAddress: {
is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
}
}
}
}
Block: {
Time: {
after: "2025-06-06T01:00:00Z"
before: "2025-06-06T02:00:00Z"
}
}
}
) {
volatility: standard_deviation(of: Trade_Buy_Price)
}
}
}
Ready to run this in production?
Get an API key and run these queries in minutes, or talk to us about plans and enterprise delivery.