Risk Based Portfolio Valuation

General

The risk based portfolio valuation provides a conservative estimate of portfolio value under adverse conditions.

  • Market participants must maintain a positive risk based valuation at all times.

  • If the valuation becomes negative, the account is subject to liquidation.

  • The exchange operator defines two risk parameters per token:

    • Risk Price

    • Risk Slippage

Adjusted Token Balance

For each token, define the adjusted balance:

Adjusted Balance(token)=Token BalanceBorrowed Quantity with Interest+Lent Quantity with Haircut\text{Adjusted Balance(token)} = \text{Token Balance} - \text{Borrowed Quantity with Interest} + \text{Lent Quantity with Haircut}

where:

Lent Quantity with Haircut=Lend Quantity×0.98\text{Lent Quantity with Haircut} = \text{Lend Quantity} \times 0.98
  • tokenBalance = user’s holdings of the token

  • borrowedQuantityWithInterest = borrowed amount plus 10 days of interest

  • lendQuantity = total amount lent to others

📌 For efficiency, lending values are aggregated as the sum of all borrowed positions with the maximum 10-day interest rate.

Margin & Portfolio Valuation

The risk-based valuation of the portfolio is:

Risk Based Valuation=Adjusted Bal(BaseToken)+Non-base tokensToken Value\text{Risk Based Valuation} = \text{Adjusted Bal(BaseToken)} + \sum_{\text{Non-base tokens}} \text{Token Value}

Token Value

For each non-base token:

tokenValue=min(tokenValuehigh,tokenValuelow)\text{tokenValue} = \min(\text{tokenValue}_{high}, \text{tokenValue}_{low})

where:

tokenValuehigh=adjustedBal(token)×adjustedTokenPricehigh+aggregatePerpValuehigh\text{tokenValue}_{high} = \text{adjustedBal(token)} \times \text{adjustedTokenPrice}_{high} + \text{aggregatePerpValue}_{high}
tokenValuelow=adjustedBal(token)×adjustedTokenPricelow+aggregatePerpValuelow\text{tokenValue}_{low} = \text{adjustedBal(token)} \times \text{adjustedTokenPrice}_{low} + \text{aggregatePerpValue}_{low}

Adjusted Token Prices

The adjusted token prices are computed as:

adjustedTokenPricehigh=pricemark×(1+riskPriceriskSlippage×sign(adjustedBal(token)))\text{adjustedTokenPrice}_{high} = \text{price}_{mark} \times \Big(1 + \text{riskPrice} - \text{riskSlippage} \times \text{sign}(\text{adjustedBal(token)})\Big)
adjustedTokenPricelow=pricemark×(1riskPriceriskSlippage×sign(adjustedBal(token)))\text{adjustedTokenPrice}_{low} = \text{price}_{mark} \times \Big(1 - \text{riskPrice} - \text{riskSlippage} \times \text{sign}(\text{adjustedBal(token)})\Big)

Adjusted Perp Values

For perpetual positions, we compute high and low valuations:

aggregatePerpValuehigh=perp positionsperpValue(markPrice×(1+riskPrice))\text{aggregatePerpValue}_{high} = \sum_{\text{perp positions}} \text{perpValue}(\text{markPrice} \times (1 + \text{riskPrice}))
aggregatePerpValuelow=perp positionsperpValue(markPrice×(1riskPrice))\text{aggregatePerpValue}_{low} = \sum_{\text{perp positions}} \text{perpValue}(\text{markPrice} \times (1 - \text{riskPrice}))

Perpetual Position Valuation

The perp value at a given price is:

Perp Value(price)=PNL from price movement + Funding Fees at that price\text{Perp Value(price)} = \text{PNL from price movement + Funding Fees at that price}

SDKs & Optimization

Risk Based Portfolio Valuation have the above formulas built in, so you can test and simulate margin requirements for different position sets.

Last updated

Was this helpful?