Nile Markets uses flat fee rates in M2 — there are no volume-based tiers or maker/taker distinctions. Every trader pays the same rates regardless of volume. Volume-tiered pricing is planned for M3.
Fee Types
| Fee | Formula | When Collected |
|---|---|---|
| Trading Fee | notional * snapshotTradingFeeBps / 10,000 | Open, increase, settlement, close, reduce |
| Liquidation Penalty | notional * snapshotLiquidationPenaltyBps / 10,000 | Liquidation only (added to trading fee) |
| Oracle Fee | Flat snapshotOracleFee per price read | Every forward price lookup |
Default Values
Trading Fee
5 bps (0.05%)Applied to the notional amount on every position open, increase, settlement, early termination, and reduction.
Liquidation Penalty
30 bps (0.3%)Applied to the notional amount only during liquidation, added on top of the trading fee. Combined liquidation fee = 35 bps.
Oracle Fee
0.10 USDCFlat fee per forward price lookup. Collected from the trader’s collateral each time a forward price is read.
Fee Distribution
All collected fees (trading fees and liquidation penalties) are split between two destinations:| Destination | Default Share | Description |
|---|---|---|
| Treasury | 30% (3,000 bps) | Protocol revenue for operations and development |
| Pool | 70% (7,000 bps) | LP compensation, directly increasing pool equity and share price |
FeeLib.distributeFee(), which iterates through all configured fee destinations and transfers proportional shares.
Fee Capping
Fees are always capped at available margin. The protocol never reverts on insufficient fee funds — it collects whatever is available. This ensures that settlement and liquidation cannot be blocked by a position that has been drained by losses.- After Profit
- After Loss
- Zero PnL
marginAfterFee + pnl.The fee waterfall is fee-first:
actualFee is computed against the full marginAtRisk, then PnL is applied from the remainder. Under bad debt, LPs absorb the difference rather than the fee being trimmed. This is a deliberate design choice that makes fee revenue independent of PnL outcomes.Fee Collection Methods
Fees are collected through different mechanisms depending on the context:| Context | Collection Method | Source |
|---|---|---|
| Position open | collectFee | Free collateral (available balance beyond locked margin) |
| Position increase | collectFee | Free collateral |
| Settlement (all types) | Deducted in _settlePosition | Locked margin — fee taken first, PnL applied to remainder |
| Oracle fee | collectFeeFromCollateral | Total collateral (can draw from locked portion) |
The oracle fee uses
collectFeeFromCollateral, which can draw from the locked portion of collateral, not just the free balance. This is because oracle fees are small (0.10 USDC) and must be collected reliably for every price read. Allowing it to draw from locked collateral prevents oracle fee collection from failing when a trader has minimal free collateral.Snapshotted Rates
All fee rates are captured at position open time and stored in the position struct:| Snapshotted Field | Default Value |
|---|---|
snapshotTradingFeeBps | 5 (0.05%) |
snapshotLiquidationPenaltyBps | 30 (0.3%) |
snapshotOracleFee | 100,000 (0.10 USDC) |
Worked Examples
Standard trading fee on position open
Standard trading fee on position open
Position:Distribution:
- Notional: 1,000 USDC (1,000,000,000 raw)
- Trading fee: 5 bps
- Treasury (30%): 0.50 * 3,000 / 10,000 = 0.15 USDC
- Pool (70%): 0.50 * 7,000 / 10,000 = 0.35 USDC
Liquidation fee (trading fee + penalty)
Liquidation fee (trading fee + penalty)
Position:Distribution:
- Notional: 1,000 USDC
- Trading fee: 5 bps
- Liquidation penalty: 30 bps
- Treasury (30%): 3.50 * 3,000 / 10,000 = 1.05 USDC
- Pool (70%): 3.50 * 7,000 / 10,000 = 2.45 USDC
Fee-first waterfall under bad debt
Fee-first waterfall under bad debt
Position:What if the loss had been 25 USDC instead?Under fee-first, the fee is always collected as long as
- Notional: 1,000 USDC
- IM locked (marginAtRisk): 20 USDC
- Calculated loss: -19 USDC
- Trading fee calculated: 1 USDC (combined trading + liquidation penalty in this example)
marginAtRisk > 0. The pool absorbs any uncollectable loss as bad debt, but fee revenue stays deterministic.Liquidation Penalty Destination
Fee on Position Increase
When a position is increased viaincreasePosition, the trading fee is calculated on the additional notional only, not the full new notional:
Fee on Position Reduction
Similarly, when a position is reduced viareducePosition, the fee is on the reduction amount only: