Documentation
SocialsStatisticsLaunch App
  • Welcome to Mars Protocol
  • Getting Started
    • How to set up a Wallet
    • Connect your wallet
    • Using a Credit Account
  • Credit Accounts
  • Perpetual Futures (Perps)
    • Perps Vault (Counterparty Vault)
    • Funding Rate Mechanism
    • Price Impact
    • Open Interest Caps
    • Vault Solvency Protection
    • Health Factor
    • Liquidations
  • Spot & Margin Trading
  • Lending & Borrowing
  • Leveraged Yield Farming
  • High Leverage Strategies
  • Managed Vaults
    • Creating a Vault
      • How to Resume Vault Creation After Failed Transaction
    • Managing a Vault
    • Depositing into Vault
  • Risk Methodology
    • Asset Listing
    • Protocol Risk Framework
    • Perps Risk Framework
      • Maximum Leverage & LTVs
      • SkewScale
      • Open Interest Caps
      • Maximum Funding Velocity
      • Mitigating Risks of Static Parameters
    • Deposit Caps Risk Framework
  • Governance
    • MARS Token
  • Smart Contracts
    • Address Provider
    • Account NFT
    • Credit Manager
    • Health
    • Incentives
    • Oracle
    • Params
    • Red Bank
    • Rewards Collector
    • Swapper
    • Zapper
    • Perps
  • Brand kit
    • The Mars Brand
  • Legal
    • Mars FUD Bible
    • Terms of Service
    • Privacy Policy
    • Cookie Policy
Powered by GitBook
On this page
  • Extreme Price Change Approach
  • Parameter Calibration Rationale
  • Key Parameters
  • Notations
  • Potential Loss for a Single Market
  • MaxOI Calculation
  • Key Assumptions
  • Input Data
  • Numerical Example
  • Manipulation Scenario Approach
  • Parameter Calibration Rationale
  • Price Manipulation Factor
  • Manipulation Scenario
  • MaxOI Calculation
  • Key Assumptions
  • Key Parameters
  • Input Data
  • Numerical Example
  • Expert Caps
Edit on GitHub
Export as PDF
  1. Risk Methodology
  2. Perps Risk Framework

Open Interest Caps

This section details how maximum open interest and maximum skew limits are determined through multiple risk assessment approaches to protect the vault from the counterparty risk.

The maximum OI is determined using an ensemble of approaches, and the minimum result is taken:

  1. Extreme Price Change Approach: Potential losses over a 6-hour horizon, assuming maximum skew (skew=maxOI) and extreme price movement in the direction of the skew, should not exceed 30% of the vault's total value.

  2. Manipulation Scenario Approach: In the event of oracle price manipulation with a specific amount of capital, the maximum profit an attacker could extract (if possible) should not exceed a predetermined portion of the vault.

  3. Expert Caps: Expert-defined maximum OI caps are also applied, such as a percentage of the total market capitalization and/or total market depth.

Extreme Price Change Approach

Parameter Calibration Rationale

The primary risk addressed when evaluating maximum open interest (and maximum net open interest) is the vault's counterparty risk. This refers to the net risk assumed by the vault as the counterparty to all trades. To mitigate this risk, we conservatively limit open interest through maximum skew (MaxSkew) and maximum open interest (MaxOI).

The rationale behind calibrating MaxSkew and MaxOI is to ensure that even if a market reaches maximum skew and the price moves sharply in the direction of the skew, the potential loss to the vault remains below a predefined threshold with high probability.

Example. With a $250k vault TVL and a $10M maximum net OI for a specific market at maximum skew, a 3% price change in the skew direction could result in a $300k unrealized profit/loss ($10M * 3%). This scenario highlights a significant bankruptcy risk for the vault when the maximum OI is substantially larger than the vault TVL.

Maximum Open Interest (MaxOI) calibration is crucial due to our soft skew cap. This mechanism limits skew only when opening or increasing positions; closing or decreasing orders are always permitted. Consequently, skew could theoretically exceed the set limits, potentially reaching the MaxOI in a single direction under extreme conditions. We calibrate MaxOI assuming a worst-case scenario where the protocol acts as the sole counterparty for all positions. Once MaxOI is established, the Maximum Skew (MaxSkew) is defined as a fixed percentage (30%) of MaxOI.

Note that in addition to maximum caps, several mechanisms help maintain skew within acceptable boundaries. These include velocity-based funding rates and price market impact. Specifically, when skew reaches and remains at its maximum, or continues to increase, the funding rate rises rapidly, reducing trader profitability. Conversely, both the funding rate and price incentives for reducing skew encourage arbitrageurs to take opposing positions. Typically, this inherent arbitrage activity should regulate the skew, keeping it below the maximum threshold. However, maximum caps are in place for extraordinary scenarios.

Key Parameters

The following parameters are used in the methodology described below:

  • Gamma γ=30\gamma = 30%γ=30: This represents the maximum potential percentage exposure for the vault. It is the upper limit for potential losses relative to the net TVL that should not be exceeded with a probability of (1 - α). A lower gamma indicates lower exposure, but reduced capital efficiency for the vault.

  • Significance Level α=1\alpha = 1%α=1: This is the significance level used for determining the extreme price change.

  • Risk Horizon h=12hh = 12hh=12h: This is the period over which extreme price changes are calibrated. It also represents the time horizon during which the protocol could be exposed to the maximum OI level and can be interpreted as the autodeleverage horizon.

  • Extreme Price Change RRR: This is the extreme percentage price change of the underlying asset that is expected to occur over the risk horizon (hhh) with a high confidence level (1 - α\alphaα).

MaxOI and MaxSkew are calculated for each market independently. This approach assumes a 0% chance that at least two markets will simultaneously experience maximum skew and extreme price changes in the direction of the skew.

The benefit of this approach is that adding a new market does not affect the risk parameters of existing markets. However, the drawback is that it disregards the risk of simultaneous extreme conditions across multiple markets. This risk increases with the number of listed markets. To mitigate this, other parameters such as the risk horizon and gamma should be chosen conservatively. A more sophisticated model could be considered in the future to account for the probabilities of multiple markets reaching maximum skew concurrently and the correlations between their price changes.

Notations

  • VVV - vault TVL

  • UPnLUPnLUPnL - Unrealized PnL for all open positions for a certain market, can be either positive or negative

  • DDD - is the vault total Debt

  • NV=V−DNV = V - DNV=V−D - vault current net TVL

  • rt+hr_{t+h}rt+h​ is the percentage price change of the underlying asset over the period [t,t+h][t, t+h][t,t+h]

  • maxOImaxOImaxOI - maximum dollar one-sided Open Interest, i.e., maximum dollar value of all open positions in one of the directions

  • KKK is the current token-denominated skew for the market, can be either positive (if the market is long-skewed) or negative (if the market is short-skewed)

  • K$K_{\$}K$​ is the current USD-denominated market skew

  • Kmax⁡K_{\max}Kmax​ is the current token-denominated maximum skew for the market

Potential Loss for a Single Market

Assuming the open interest (OI) in token amounts remains constant over the period [t,t+h][t, t+h][t,t+h] (meaning no positions are opened or closed), the unrealized profit and loss (UPnL) for a single market at time t+ht+ht+h is:

UPnLt+h=∑qj(pt+h−pj)=pt+h∑qj−∑qjpj=pt+hKt−∑qjpjUPnL_{t+h} = \sum q_{j}(p_{t+h} - p_{j}) = p_{t+h} \sum q_{j} - \sum q_{j} p_{j} = p_{t+h} K_{t} - \sum q_{j} p_{j}UPnLt+h​=∑qj​(pt+h​−pj​)=pt+h​∑qj​−∑qj​pj​=pt+h​Kt​−∑qj​pj​

where:

  • qjq_{j}qj​ is the jjjth position size (positive for longs and negative for shorts)

  • pjp_{j}pj​ is the entering price for the jjjth position

  • Kt=∑qjK_{t} = \sum q_{j}Kt​=∑qj​ is the token-denominated market skew at time ttt

Let's assume that all N traders entered their positions simultaneously at time ttt using the average opening price across all positions as p0,t=1N∑pjp_{0,t} = \frac{1}{N} \sum p_{j}p0,t​=N1​∑pj​. Then the total unrealized PnL is:

UPnLt+h=Kt⋅(pt+h−p0)=Kt⋅p0,t⋅rt+h=Kt,UPnLt+h=Kt⋅(pt+h−p0)=Kt⋅p0,t⋅rt+h=Kt,UPnLt+h=Kt⋅(pt+h−p0)=Kt⋅p0,t⋅rt+h=Kt,

⋅rt+hUPnLt+h=Kt⋅(pt+h−p0)=Kt⋅rt+hUPnL_{t+h} = K_{t} \cdot (p_{t+h} - p_{0}) = K_{t}⋅rt+hUPnLt+h​=Kt​⋅(pt+h​−p0​)=Kt​,

​⋅rt+h​​⋅rt+h​​⋅rt+h​

UPnLt+h=Kt⋅(pt+h−p0)=Kt⋅p0,t⋅rt+h=Kt,$⋅rt+hUPnL_{t+h} = K_{t} \cdot (p_{t+h} - p_{0}) = K_{t} \cdot p_{0,t} \cdot r_{t+h} = K_{t,\$} \cdot r_{t+h}UPnLt+h​=Kt​⋅(pt+h​−p0​)=Kt​⋅p0,t​⋅rt+h​=Kt,$​⋅rt+h​

where rt+hr_{t+h}rt+h​ is the asset price return over the horizon hhh.

This UPnL represents the vault potential loss coming from the price change for a period [t,t+h][t, t+h][t,t+h] under the static skew assumption.

MaxOI Calculation

We consider each market to be isolated from other markets and ignore the joint probability of extreme scenarios for at least two markets. Basically, we assume that there is only one perp market.

The maximum open interest (MaxOI) is set to ensure that potential extreme losses for the vault remain below a specific percentage ($\gamma$) of the vault's net Total Value Locked (TVL) with a certain probability. This determination is based on the following conditions:

  • The skew is at its maximum value, $K_{max,$}$

  • Extreme price movements occur in the direction of the skew

Let assume the worst-case scenario when all open positions are on the one side of the market and the magnitude of the imbalance and one-sided open interest are the same:

Kmax,$=maxOIK_{max,\$} = maxOIKmax,$​=maxOI

In this scenario, the protocol is effectively the sole counterparty to all positions.

We require the following probabilistic equation to hold:

P{UPnLt+h≥γ⋅NVt}=P{rt+h⋅maxOI≥γ⋅NVt}=αP\{UPnL_{t+h} \geq \gamma \cdot NV_{t}\} = P\{r_{t+h} \cdot maxOI \geq \gamma \cdot NV_{t}\} = \alphaP{UPnLt+h​≥γ⋅NVt​}=P{rt+h​⋅maxOI≥γ⋅NVt​}=α

Solving this equation yields the upper bound for the maximum OI:

maxOI=γ⋅NVRmaxOI = \frac{\gamma \cdot NV}{R}maxOI=Rγ⋅NV​

where R=Fr−1(α,h)R = F_{r}^{-1}(\alpha, h)R=Fr−1​(α,h) is the extreme quantile of the asset return distribution.

The parameter RRR is determined using the CVaR risk metric over the chosen horizon:

for longs: RL=CVaRr(1%,h)R_{L} = CVaR_{r}(1\%, h)RL​=CVaRr​(1%,h)

for shorts: RS=CVaRr(99%,h)R_{S} = CVaR_{r}(99\%, h)RS​=CVaRr​(99%,h)

To calculate the CVaR metric for each market, we employ a historical simulation method using the previous year's price data. For simplicity, we assume symmetrical price fluctuations and conservatively apply the same magnitude of change in both upward and downward directions:

R=max⁡(∣RL∣,∣RS∣)R = \max(|R_{L}|, |R_{S}|)R=max(∣RL​∣,∣RS​∣)

Key Assumptions

  • Skew is at maximum for the particular market

  • Skew is zero for all other markets or their prices are constant during the risk horizon

  • The market price changes significantly in the skew direction for a particular market

  • The price market impact is ignored for simplicity

  • Closing fees are excluded for conservatism

  • Compounding funding payments accumulated over the risk horizon are excluded. Note that in accordance with the maxFundingVelocitymaxFundingVelocitymaxFundingVelocity calibration procedure, when the skew exceeds the critical level, the funding rate velocity reaches its maximum. Consequently, maintaining a position in the skew direction becomes unprofitable over time due to high accumulated funding payments. Therefore, ignoring funding is a conservative approach

  • The positions set is static. There are no arbitrageurs, and traders do not close positions to reduce the skew. No changes occur in the market (no positions are opened, closed, or liquidated); thus, the token-denominated skew remains constant during the horizon hhh (K=constK = constK=const). This represents the worst-case scenario

  • The vault TVL is static (V=constV = constV=const), meaning no liquidity inflows or outflows occur during the horizon hhh

Input Data

Data Item
Description
Source
Period/Frequency
Processing

The vault dollar TVL net of the debt

SC

-

-

Historical oracle price of the underlying asset

Coingecko

1h over the past 365 days

-

Numerical Example

  • Vault TVL VVV = $500k

  • Vault Debt DDD = $100k

  • Net Vault TVL NV=V−D=$400kNV = V - D = \$400kNV=V−D=$400k

  • Extreme price change RRR = 40%

  • Gamma γ\gammaγ = 30%

Deriving from the MaxOI formula:

maxOI=γ⋅(V−D)R=0.3⋅$400k0.4=$300kmaxOI = \frac{\gamma \cdot (V - D)}{R} = \frac{0.3 \cdot \$400k}{0.4} = \$300kmaxOI=Rγ⋅(V−D)​=0.40.3⋅$400k​=$300k

The potential loss associated with the MaxOI is:

UPnL=R⋅maxOI=0.4⋅$300k=$120kUPnL = R \cdot maxOI = 0.4 \cdot \$300k = \$120kUPnL=R⋅maxOI=0.4⋅$300k=$120k

This represents 30% of the vault's total net TVL:

UPnLV−D=$120k$400k=0.3=30%\frac{UPnL}{V - D} = \frac{\$120k}{\$400k} = 0.3 = 30\%V−DUPnL​=$400k$120k​=0.3=30%

Based on the historical returns of the underlying asset, there is a 1% probability that the maximum potential loss will surpass 30% of the vault's value within a given risk horizon.

Manipulation Scenario Approach

Parameter Calibration Rationale

To mitigate market price manipulation risk, the maximum obtainable profit for an attacker within a specific market must be capped at a defined portion of the vault.

Price Manipulation Factor

Let a user manipulate the market price: making transactions of large volume CCC the price is shifted by β%\beta\%β% (e.g. for the JELLY market the price was pumped by β\betaβ=~400% using 63% of total market capitalization which was around $15M).

A potential price pump/dump β\betaβ depends on two factors:

  • The manipulation capital: Higher capital used for manipulation can lead to a greater price pump or dump. We conservatively assume a large manipulation capital (as seen in the Mango attack, $20M).

  • The market liquidity (depth): More liquid markets require greater capital to shift the price. A precise approach would consider the depth from the specific feeds used in the Slinky price oracle for each market. This could involve using the minimum depth across all feeds, the feed with the maximum voting power, or a vote-weighted depth. However, implementing this requires knowledge of the feeds used for each market and the validators' power distribution, making it a potential future enhancement to this methodology.

Based on a simplified method utilizing ±s\pm s%±s global market depth data from leading exchanges and pairs and a linear market impact model, the price manipulation factor can be determined as follows:

β=C⋅2%min⁡(Depth+s%,$,Depth−s%,$)\beta = C \cdot \frac{2\%}{\min(Depth_{+s\%,\$}, Depth_{-s\%,\$})}β=C⋅min(Depth+s%,$​,Depth−s%,$​)2%​

Manipulation Scenario

Position Setup:

  • Attacker opens nearly balanced long and short positions (A and B)

  • Net exposure E(A-B) is minimal, appearing neutral

  • One position is well-collateralized, the other is minimally collateralized

  • With multiple short-long positions, a user can theoretically open positions up to the maximum OI on Mars because the skew will be kept near zero

Attack Execution:

  • Attacker triggers price jump on one of the exchanges (with thin liquidity)

  • A well-collateralized position makes substantial profit

  • Under-collateralized position gets liquidated, with losses exceeding its collateral (potentially a bad debt if not liquidated on time)

  • The vault absorbs the uncovered losses

Considering a scenario where an attacker establishes a position with a dollar value equal to the maximum open interest (maxOI) and subsequently manipulates the price upwards, the total OI in dollar terms would surpass the maxOI limit. This condition would activate the auto-deleverage mechanism, which would close the most profitable positions. However, for the sake of conservatism, this scenario is not explicitly factored into the methodology for risk parameters estimation.

MaxOI Calculation

Allow a user to open a position (or a set of positions) with the maximum possible size, equal to the maximum long or short open interest. Since price manipulation strategies are typically short-term, funding payments do not have sufficient time to accumulate and are therefore excluded from consideration. The maximum profit obtainable from price manipulation in either the long or short direction is calculated as follows:

MaxProfit=MaxOI⋅βMaxProfit = MaxOI \cdot \betaMaxProfit=MaxOI⋅β

The profit should be capped at a specific percentage of the vault's TVL (for instance, 30% or less).

MaxOI⋅β≤γ⋅NVMaxOI \cdot \beta \leq \gamma \cdot NVMaxOI⋅β≤γ⋅NV

The formula above yields the maximum permissible open interest for each market.

MaxOI=γ⋅NVβMaxOI = \frac{\gamma \cdot NV}{\beta}MaxOI=βγ⋅NV​

where

β=C⋅s%min⁡(Depths%,$,Depth−s%,$)​β = C \cdot \frac{s\%}{\min(Depth_{s\%,\$}, Depth_{-s\%,\$})}​β=C⋅min(Depths%,$​,Depth−s%,$​)s%​​

Key Assumptions

  • A linear price impact model is used

  • Manipulation capital is fixed and doesn't depend on the market capitalization and Slinky feed

Key Parameters

  • C=$20MC = \$20MC=$20M - manipulation capital

  • γ=30%\gamma = 30\%γ=30% - the vault maximum percentage potential exposure

Input Data

Data Item
Description
Source
Period/Frequency
Processing

Coingecko

90-day median

-

The vault dollar TVL net of debt

SC

-

-

Numerical Example

Consider a JELLY market:

  • Market Cap = $20M

  • Depth (5%) = $200K

  • Manipulation capital=$16M (63% of market cap)

β=C⋅5%Depth±5%,$=$16M⋅0.05$0.2M=$16M⋅0.05$200K=4=400%\beta = C \cdot \frac{5\%}{Depth_{\pm 5\%,\$}} = \$16M \cdot \frac{0.05}{\$0.2M} = \$16M \cdot \frac{0.05}{\$200K} = 4 = 400\%β=C⋅Depth±5%,$​5%​=$16M⋅$0.2M0.05​=$16M⋅$200K0.05​=4=400%

The maximum open interest permitted is:

MaxOI=γ⋅Vβ=0.3⋅$500K4=$150K4=$37.5kMaxOI = \frac{\gamma \cdot V}{\beta} = \frac{0.3 \cdot \$500K}{4} = \frac{\$150K}{4} = \$37.5kMaxOI=βγ⋅V​=40.3⋅$500K​=4$150K​=$37.5k

Expert Caps

The final model's MaxOI is subject to the following expert-defined upper limits:

Quality Category
Multiplier to Global Depth

Very Good

5

Good

5

Medium

3

Bad

3

Very Bad

3

The final cap is determined as the minimum between the caps derived using Approach 1 and Approach 2 capped with the expert-based limits.

The MaxSkew is capped at 30% of MaxOI. Final parameters are rounded to a specific power of 10 depending on number' magnitude.

Last updated 3 days ago

Aggregated global market depth across leading exchanges and pairs

NVNVNV
ppp
Depth±2%,$Depth_{\pm 2\%,\$}Depth±2%,$​
±2%\pm 2\%±2%
NVNVNV