- Fixed Platform Fees: A simple percentage-based fee specified in basis points.
- Dynamic Platform Fees: A price-dependent fee that scales with market probability, used specifically for prediction market outcome token trades.
Use Case
Integrators building applications on top of DFlow can collect platform fees on every trade executed through their integration. This enables monetization of your integration while providing value to end users through DFlow’s aggregated liquidity and routing. Platform fees are specified in basis points (1 basis point = 0.01%). For example, a 20 bps fee equals 0.2% of the trade amount. You can collect fees from either the input or output token of the swap, depending on your configuration.Platform Fee Parameters
DFlow provides three key parameters for configuring platform fees:platformFeeMode
Controls which token the platform fee is collected from. See theplatformFeeMode parameter in the API reference.
outputMint(default): Fee is collected from the output token of the swapinputMint: Fee is collected from the input token of the swap
For outcome token trades,
platformFeeMode is ignored and the fee is always
collected in the settlement mint.platformFeeBps
A fixed platform fee specified in basis points (1 basis point = 0.01%). See theplatformFeeBps parameter in the API reference.
- Example:
platformFeeBps: 50means a 0.5% fee - The fee is calculated as a percentage of the trade amount
- Can be collected from either input or output mint based on
platformFeeMode
platformFeeScale
A dynamic fee scale used specifically for outcome token trades. See theplatformFeeScale parameter in the API reference.
The fee is calculated using the formula: k * p * (1 - p) * c
Where:
k=platformFeeScale(with 3 decimals precision, e.g.,50= 0.050)p= all-in price (includes all fees + filled price)c= contract size
When
p = 1
(redemption
of a winning outcome), the fee is zero. Users do not pay a fee for outcome
mint redemption.Fee Account Requirements
To collect platform fees, you must specify afeeAccount parameter on the API endpoints:
- The fee account must be a valid token account that matches the fee mint (input or output token, depending on
platformFeeMode) - For outcome token trades, the fee account must be a settlement mint account
- The fee account must be initialized before the trade executes
You can use the
referralAccount
parameter to automatically create the fee account if it doesn’t exist. The fee
account will be derived from the referral account using the Referral program.Related Resources
Order Endpoint Reference
Complete API reference for the /order endpoint, including all platform
fee parameters.
Quote Endpoint Reference
API reference for the /quote endpoint for imperative swaps.
Intent Endpoint Reference
API reference for the /intent endpoint for declarative swaps.
Concurrent Trading
Learn about sync and async trade execution modes.