DNF and Leverage
FYI, current live values can be found in the live market-analyzer.
Spot-price perpetual protocols without delta neutrality fee have no native price discovery mechanism. The model depends on arbitrage with the spot market to propagate the price response through the spot price oracle.
If the perpetual swaps volume starts to approach the volume on the spot market, big trades on the protocol without a delta neutrality fee would benefit traders at the expense of liquidity providers by creating small-scale flash meltdowns and meltups.
Spot market manipulation also starts to become more profitable. If an attacker is able to manipulate the spot market price short-term by a significantly higher margin than trading fees on the protocol, they are able to guarantee a profit from the protocol, ultimately draining liquidity providers.
This is why Levana introduced the DNF parameter. However, the downside for traders is that there is an inverse relationship between DNF and max leverage. Meaning that a higher leverage requires lowering the DNF sensitivity. So, the smaller the market, the more sensitive it is to attacks.
For example, increasing max leverage from 4x to 30x tightens DNF caps by about 8 times, making the market more sensitive to imbalance. In a low liquidity market, this could mean the cap for market imbalance drops from $400k to $50k, restricting position openings.
Determining DNF sensitivity, DNF cap, and max leverage
The full calculation of DNF sensitivity is described below.
It's important to note that when we are calculating the max leverage, we are interested in the DNF_sensitivity in USD NOT the notional.
That is because we then use a unified scale to determine the leverage. That scale is:
DNF Sensitivity (USD) -> max Leverage
<20m: 4x
20-50m: 10x
50m-200m: 30x
>200m: 50x
Once the max leverage is determined, we can calculate the dnf_cap.
The mapping for delta_neutrality_fee_cap that has been used to ensure that there is no immediate liquidatability
(assuming the usual params for funding/borrow caps and trading fees) are:
4x: 0.03
6x: 0.025
10x: 0.015
30x: 0.005
50x: 0.0002
Please note that the dnf_sensitivity parameter must be converted back to notional, because it is used in other areas that assume it is in notional.
For example, the funding rates are calculated using notional interest, and notional DNF. Using a dnf_usd would lead to wrong funding rate values.
Calculating the DNF sensitivity (With example)
These are the steps for calculating DNF sensitivity for a market pair
like BASE_USD or BASE_USDC. These steps are not applicable if the
quote asset is something else.
As said earlier, we will use the spot markets to determine the trading volumes, and as a result the DNF sensitivity and leverage.
Repeat this step for 7 days:
- Open coingecko / markets / Spot.
- Remove all DEX from consideration.
- Remove HTX (Huobi) from consideration. There has been reports of them 'faking' volume by using bots running on 2 accounts, the places rapid and large amounts of limit orders. More can be found here. This artificial volume is detrimental to our study, and thus we remove HTX from the list.
- Remove all exchanges which has been either inactive or if coingecko indicates that there is anomaly in the trading price or volume.
- Sort by 24h volume in decreasing order.
- Calculate the sum of
Volume %of the filtered exchanges. - Note down the first exchange in the list.
- Calculate the sum of
- For the first exchange on the list:
- Calculate it's market share by dividing its volume percentage by that sum of volume percentage that you calculated in the above step.
- For that exchange, choose lowest of +2% and -2% depth liquidity and divide it by the market share value that you computed in the above step.
- Multiply the result by 25 to get the DNF sensitivity.
- The DNF parameter is given in the notional asset. The calculations above will give you a value in the quote asset. For collateral-is-base markets, notional and quote are the same asset, so no further actions are needed.
- The value computed here can be used to choose max leverage parameter:
<20m: 4x
20-50m: 10x
50m-200m: 30x
>200m: 50x
Note that m stands for a million.
Note that if you are having a market like LVN_SEI, then compute the
DNF based on the rest of the algorithm. Then multiply it by the price
of the asset to get USD-equivalent DNF sensitivity for the purpose of
deciding on max leverage.
If max leverage is less than 3m, then it's best not to launch it. The carry leverage is usually chosen as half the max leverage.
- For collateral-is-quote markets, you need to convert from the quote to the base asset by dividing by the current price of the asset.
If the quote pair is different, then this is the formula:
DNF_SENSITIVITY(XXX_YYY) = MIN(DNF_SENSITIVITY(XXX_USD), DNF_SENSITIVITY(YYY_USD))
The DNF sensitivity that you have calculated above is for a particular day. You would have to repeat the same for successive days. Once you have enough data, you would have to choose a conservative value out of it. In the above steps, you have to choose a specific day based on which you will perform calculations. For DNF calculation, we will choose the day with the exchange that has a minimum of (+/-)2% liquidity depth (Note that the exchange itself will be chosen which has the highest trading volume, but liquidity depth is used to determine which day will be chosen for calcuating DNF).
Calculation example
Let's follow the above steps for the LVN coin for a single day:

- Removing all DEX and other exchanges, leaves us with three exchanges: MEXC, Gate.io (All DEX are elimited, HTX is eliminated, Bitrue is eliminated because of anomaly)
- Sorting it, we have two filtered exchanges: MEXC and Gate.io
- Calculate Sum of volume %:
SUM(1.06, 0.9) = 1.96
- Compute Market share: 1.06/1.96 = 0.54
- MIN(7719, 5828) = 5828
- DNF sensitivity: (5828/0.54)*25 = 269814.81