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
Fee capping means that in bad debt scenarios (where the trader’s loss exceeds their margin), the protocol may not collect the full fee. This is by design — the priority order is: (1) settle PnL, (2) collect fees from remainder. The protocol prioritizes correct PnL settlement over fee collection.
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 (after PnL) |
| 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 capping after a large loss
Fee capping after a large loss
Position:In this case, the margin after loss (2 USDC) is enough to cover the 0.50 USDC fee.But if the loss were 19.80 USDC:The protocol collects only 0.20 USDC instead of the full 0.50 USDC. The remaining 0.30 USDC is not collected and is effectively absorbed as reduced protocol revenue.
- Notional: 1,000 USDC
- IM locked (marginAtRisk): 20 USDC
- Realized loss: -18 USDC (capped at margin)
- Trading fee calculated: 0.50 USDC
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: