Skip to main content

DFlow API: Solana Swaps, Routes, Fees and Traders

DFlow is a Solana trading infrastructure company. Its aggregator, DFlow Swap, routes a trade across several venues for the best price, and apps reach it through the DFlow Trade API. The on-chain program is DF1ow4tspfHX9JwWJsAb9epbkA8hmpSEAtxXy1V27QBH. Bitquery records each aggregated swap in the Solana DEXTrades and DEXTradeByTokens cubes under ProtocolName: "dflow" and ProtocolFamily: "DFlow". In the hour to 10:00 UTC on 2026-10-26 DFlow carried about 39,000 trades worth $7.4 million.

Two things shape every query on this page:

  • The user's wallet is in Trade.Buy.Account.Owner, not always in Transaction.Signer. Apps such as FOMO sign and pay for their users' transactions, so the signer is the app. The DFlow row still carries the user's own wallet as the account owner. Wallets and bots that trade directly sign their own transactions, so signer and owner match.
  • A routed swap produces more than one trade row. The DFlow row is the user's trade, from the input token to the output token. The pools the route passed through appear as separate rows with their own protocol names. Filter on ProtocolName: "dflow" to count each user trade once.

Every example runs in the Bitquery IDE. To stream one, change query to subscription and remove limit and orderBy. For the FOMO app, which routes most of its trades through DFlow, see the FOMO API.

Latest DFlow swaps​

Each row is one user trade: what the user received (Buy), what they paid (Sell), the USD value and the user's wallet.

Run it in the IDE ➤

query DFlowLatestSwaps {
Solana {
DEXTrades(
limit: {count: 20}
orderBy: {descending: Block_Time}
where: {Trade: {Dex: {ProtocolName: {is: "dflow"}}}, Transaction: {Result: {Success: true}}}
) {
Block {
Time
}
Transaction {
Signature
Signer
}
Trade {
Buy {
Amount
AmountInUSD
Account {
Owner
}
Currency {
Symbol
MintAddress
}
}
Sell {
Amount
AmountInUSD
Currency {
Symbol
MintAddress
}
}
Dex {
ProtocolName
ProgramAddress
}
}
}
}
}

Apps and bots routing through DFlow​

Groups the last hour of DFlow trades by transaction signer. A signer with many distinct user wallets is an app that signs for its users; a signer with one wallet is a wallet or bot trading for itself.

Run it in the IDE ➤

query DFlowSigners {
Solana {
DEXTrades(
limit: {count: 20}
orderBy: {descendingByField: "trades"}
where: {Trade: {Dex: {ProtocolName: {is: "dflow"}}}, Block: {Time: {since_relative: {minutes_ago: 60}}}, Transaction: {Result: {Success: true}}}
) {
Transaction {
Signer
}
trades: count
users: uniq(of: Trade_Buy_Account_Owner)
volume_usd: sum(of: Trade_Buy_AmountInUSD)
}
}
}

Most traded tokens on DFlow​

Ranks tokens by USD volume through DFlow in the last hour, leaving out SOL and USDC so the list shows what users are buying and selling.

Run it in the IDE ➤

query DFlowTopTokens {
Solana {
DEXTradeByTokens(
limit: {count: 20}
orderBy: {descendingByField: "volume_usd"}
where: {Trade: {Dex: {ProtocolName: {is: "dflow"}}, Currency: {MintAddress: {notIn: ["So11111111111111111111111111111111111111112", "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"]}}}, Block: {Time: {since_relative: {minutes_ago: 60}}}, Transaction: {Result: {Success: true}}}
) {
Trade {
Currency {
Symbol
MintAddress
}
}
trades: count
volume_usd: sum(of: Trade_Side_AmountInUSD)
}
}
}

DFlow trades of one wallet​

Filters on the user's wallet as the account owner, which works whether the user signed the trade or an app signed it for them. Replace the address with the wallet you want.

Run it in the IDE ➤

query DFlowWalletTrades {
Solana {
DEXTrades(
limit: {count: 20}
orderBy: {descending: Block_Time}
where: {Trade: {Dex: {ProtocolName: {is: "dflow"}}, Buy: {Account: {Owner: {is: "A5Y3Wz4t2trwdezJyWgaeugNEu6HfuQgEk8Bb8D2UF5Y"}}}}, Transaction: {Result: {Success: true}}}
) {
Block {
Time
}
Transaction {
Signature
Signer
}
Trade {
Buy {
Amount
AmountInUSD
Currency {
Symbol
}
}
Sell {
Amount
Currency {
Symbol
}
}
}
}
}
}

Route legs: which venue each DFlow swap used​

The DFlow program logs a SwapEvent for every leg of a route. amm is the program of the venue that filled the leg, and the mints and amounts are that leg's input and output, in each token's smallest unit.

Run it in the IDE ➤

query DFlowRouteLegs {
Solana {
Instructions(
limit: {count: 20}
orderBy: {descending: Block_Time}
where: {Instruction: {Program: {Address: {is: "DF1ow4tspfHX9JwWJsAb9epbkA8hmpSEAtxXy1V27QBH"}, Method: {is: "SwapEvent"}}}, Transaction: {Result: {Success: true}}}
) {
Block {
Time
}
Transaction {
Signature
}
Instruction {
Program {
Arguments {
Name
Value {
... on Solana_ABI_Address_Value_Arg {
address
}
... on Solana_ABI_BigInt_Value_Arg {
bigInteger
}
}
}
}
}
}
}
}

Fees taken on DFlow swaps​

Apps that integrate DFlow can charge a fee on each swap. The program logs a FeeEvent with the fee account, the mint and the amount in the mint's smallest unit.

Run it in the IDE ➤

query DFlowFees {
Solana {
Instructions(
limit: {count: 20}
orderBy: {descending: Block_Time}
where: {Instruction: {Program: {Address: {is: "DF1ow4tspfHX9JwWJsAb9epbkA8hmpSEAtxXy1V27QBH"}, Method: {is: "FeeEvent"}}}, Transaction: {Result: {Success: true}}}
) {
Block {
Time
}
Transaction {
Signature
Signer
}
Instruction {
Program {
Arguments {
Name
Value {
... on Solana_ABI_Address_Value_Arg {
address
}
... on Solana_ABI_BigInt_Value_Arg {
bigInteger
}
}
}
}
}
}
}
}

Pitfalls​

  • Count user trades on the DFlow row only. Adding the pool rows of the same transaction counts each trade two or more times.
  • Signer is not the user for app trades. Use Trade.Buy.Account.Owner for the user's wallet.
  • Instruction data covers about 8 hours. The route-leg and fee queries read Instructions, which is real-time only. Trade queries can go further back with dataset: archive.

Frequently Asked Questions

What is DFlow on Solana?

A Solana trading infrastructure company. Its aggregator, DFlow Swap, routes trades across venues for the best price, and apps reach it through the DFlow Trade API. The program is DF1ow4tspfHX9JwWJsAb9epbkA8hmpSEAtxXy1V27QBH.

How do I get DFlow trades?

Query Solana DEXTrades with Trade.Dex.ProtocolName equal to dflow. Each row is one user trade with the amounts, USD value and the user's wallet in Trade.Buy.Account.Owner.

Which apps trade through DFlow?

Group DFlow trades by Transaction.Signer and count distinct Trade.Buy.Account.Owner values. Signers with many users are apps that sign for their users, such as FOMO.

Which venues does DFlow route to?

Read the program's SwapEvent instructions. The amm argument on each event is the program of the venue that filled that leg.

Build with Bitquery

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.