Margin Engine v1
Last updated
Last updated
Making the margin calculations too simple and strict leads to a problem of over-collateralized leverage and low capital efficiency. In contrast, simplistic calculations without restrictions will lead to even worse consequences - creditors take a huge risk providing the leverage. Ideally, the margin engine should take into account the following:
Trading and asset management specifics.
Underlying asset dynamics and risks.
Aggregated portfolio risk.
In traditional finance, there are several methodologies to approach margin calculations for a multi-asset portfolio. is one of them.
In Arkis, our goal is to create a margin engine that takes into account DeFi and CeFi trading specifics and new types of asset classes (liquidity pools, exotic derivatives) as well as the volatile nature of crypto-assets, and we use the SPAN model as a starting point in our process.
Proper portfolio risk estimation requires complex computations and scenario simulations that consider asset dependence and correlation. Currently, it’s not feasible to perform these intricate calculations on the blockchain due to computational and cost constraints.
Therefore, while our margin calculation remains centralized, we ensure transparency and accessibility.
At its core, the Margin Engine operates by:
Estimating Stress-Tested Portfolio Value (STPV): Each asset within a Margin Account has a configurable stress-test(ST)—a discount-adjusted factor that adjusts its market price based on historical volatility, liquidity conditions, and other risk parameters.
Calculating the Risk Factor (RF): The Risk Factor is computed as the ratio of the stress-tested portfolio value to the total borrowed amount:
A Risk Factor greater than 1.0 indicates that even under stress, the portfolio covers the liabilities; a value below 1.0 signals a critical risk of default, triggering margin calls or liquidation.
Methodology
For each asset (i) in a Margin Account, the engine determines its stress-tested value (STV_i) as:
Market_Price_i
is the current on-chain price for asset i.
Stress-Tested_Multiplier_i
is a configurable parameter for asset i
within a Liquidity Pool that reflects its risk characteristics.
The Portfolio Stress-Tested Value (STPV) is the sum of these values across all assets:
This approach provides a conservative estimate of the total collateral value under stressed market conditions.
Example
Consider a Margin Account holding two assets:
Asset A (ETH):
Market Value: $100,000
Stress-Tested Multiplier: 0.30
Therefore,STV_A = 100,000 * 0.70 = $70,000
Asset B (Pendle PT):
Market Value: $50,000
Stress-Tested Multiplier: 0.40
Therefore, STV_B = 50,000 * 0.60 = $30,000
Then, the total Portfolio Stress-Tested Value (STPV) is:
The Risk Factor (RF) is calculated using the following formula:
If RF > 1.0: The portfolio’s stress-tested collateral covers the borrowed value (the account is healthy).
If RF = 1.0: The account reaches the margin call threshold.
If RF < 1.0: The collateral under stress is insufficient relative to the debt, and liquidation is triggered.
Margin Engine v1 whitepaper can be found here: