Risk Management Overview
This section describes how Marginly manages risks
Risk framework
The Marginly v1 risk framework achieves the following:
Maximizes capital efficiency through leveraged trading activity.
Optimizes on-chain handling of the framework parameters.
Minimizes the probability of pool insolvency.
By implementing the loan pricing mechanism in the previous section, Marginly incorporates risk framework directly into the smart contract business logic:
Marginly v1 uses the base asset (ETH) volatility as a risk proxy.
Marginly v1 prices long and short positions in aggregate: protocol calculates long and short leverage of the entire pool and uses them to scale long and short interest rates.
Marginly v1 updates users' positions on-action basis where each public method in smart contracts firstly accrues user debts (recalculates compounded interest), recalculates leverage, and performs liquidations if needed.
Marginly v1 implements a decentralized price oracle and uses Uniswap v3's TWAP to calculate and update user positions.
Marginly v1 stores two max-heaps of long and short users' leverages in a smart contract where each public method always tries to margin call the top 1 position if its leverage is > 20 and update the heap.
Marginly v1 implements a public
receive_position()
method, which allows calling for margin in any liquidating position with outside liquidity.Marginly v1 implements additional deleveraging functionality, which allows long buyers to absorb liquidating short positions and vice-versa.
Risk management
Marginly further enhances risk management by closely considering the following two broad risk categories related to spot-leveraged trading:
Volatility Risk
The higher the volatility of the ETH, the less likely pool is to recover the full loan amount in the event of default.
Marginally incorporates volatility into the interest rate calculation, so traders pay more for the risk when the market volatility is high. Governance has a dashboard to monitor volatility and changes the interest rate parameter on-chain.
ETH price may experience sharp jumps, with intraday returns swinging as much as 25% on both sides. Imagine an example where the ETH price jumped lower, and there are a lot of leveraged long positions in the system holding ETH as collateral. Highly leveraged positions will be at risk of getting insolvent: market panic, multiple accounts being liquidated, blockchain network congestion, and liquidity drying out on Uniswap, all in conjunction, will lead to the inability to recover the full loan amount when liquidating. Marginly uses the insurance pool as a liquidity of last resort to cover possible protocol losses in such scenarios.
System participants / Marginly DAO will have a dashboard to monitor system solvency and the pace of asset accumulation in the insurance pool.
Liquidity Risk
The lower the liquidity depth in the ETH/USDC uniswap pool, the less likely the pool to recover the full loan amount in the event of default.
Expected shortfall (ES) shows what is the average worst 1% return ETH may demonstrate during a single day. It is then used to calculate how much collateral is at risk of liquidation. This collateral’s realizable value depends on the liquidity depth in uniswap.
System participants have a dashboard to monitor uniswap liquidity and effective realisable price given current liquidity conditions.
Last updated