Comment on page

Subaccounts, Isolated Margin, and Health

Defining Vertex's subaccount design and weighted margin calculations.

Subaccounts – Cross Margin by Default

Each address on Vertex can open an arbitrary number of subaccounts, which Vertex treats as an independent account with its own margin, balances, positions, and trades. If liquidated, the only assets at risk are those in a subaccount. Traders with assets in multiple subaccounts do not carry risk between those subaccounts.
By default, all subaccounts on Vertex are cross-margined. The benefits include:
  • Capital efficiency.
  • Lower risk of liquidation on positions.
  • Ability to easily compound profits.
To learn more about Vertex’s Cross Margin accounts, click here.

Isolated Margin

On many exchanges, users can trade with Isolated Margin. Isolated Margin is an unshareable margin assigned to a single leveraged position, enabling users to isolate the capital at risk to a single position.
Traders on Vertex can isolate risk associated with individual positions by opening new subaccounts. For example, to create an isolated margin position on Vertex, a trader could create a new subaccount, deposit collateral, and open a new position.
Initially, Vertex will NOT launch with isolated margin for perpetuals. The isolated margin feature will be added later after mainnet launch.


Vertex uses a concept of weighted margin, which we refer to as Health, to enable efficient cross-margining across products. Health is used to determine if an account can open new positions or can be liquidated in the event of adverse price movements.
Health’s purpose is to allow ALL positions in a user’s account to contribute to their margin and trading activity. The result is:
  • Better capital efficiency.
  • Improved risk management.
  • Boosted portfolio flexibility.
  • Increased utility for tokens.
As a result, several factors need to be considered.

Health Types

There are two types of health:
  • Maintenance Health: If Maintenance Health < 0, accounts can be liquidated.
  • Initial Health: If Initial Health < 0, accounts cannot open new positions.
In the parlance of other exchanges:
  • Maintenance Health ≈ USDC to Liquidation
  • Initial Health ≈ Free Collateral


Given the inclusion of all assets in a portfolio, it is necessary to account for the following:
  • Collateral Quality
  • Volatility
  • Liquidity
This is achieved by assigning a “weight” to all products.

Weight Parameters

Each product has four parameters:
  • maintenance_asset_weight
  • maintenance_liability_weight
  • initial_asset_weight
  • initial_liability_weight
Maintenance health is computed using maintenance weights, and initial health is calculated using initial weights.

Spot Health

Spot assets are the core collateral assets for Vertex. For example, tokens deposited into Vertex’s smart contracts can be used to trade other assets. Their contribution to health can be calculated as follows:
Spot Health Formula
A user has 5 BTC in their account, and BTC spot is trading at $10,000. Let’s calculate the initial and maintenance health:
  • maintenance_asset_weight = 0.9
  • maintenace_liability_weight = 1.1
  • initial_asset_weight = 0.8
  • initial_liability_weight = 1.2
  • Initial Health = 5 * 10,000 * 0.8 = $40,000
  • Maintenance Health = 5 * 10,000 * 0.9 = $45,000
Given the lack of other positions in our account, our user has $40,000 of collateral value available for new positions.

Perpetual Health

Perpetuals are the other primary product type on Vertex. Perpetuals on Vertex are also subject to variable funding rates that tether the price to the underlying spot asset. For details on funding rate calculations for perpetuals, skip to the section covering the topic here.
Given their embedded leverage, perpetuals have a similar but slightly different calculation for health:
Perp Health Formula
A user decides to short 5 BTC-Perps, and the price is $10,000. Let’s calculate the initial and maintenance health:
  • maintenance_asset_weight = 0.95
  • maintenace_liability_weight = 1.05
  • initial_asset_weight = 0.9
  • initial_liability_weight = 1.1
  • Initial Health = -5 * 10,000 * 1.1 - (-5 * 10,000) = -$5000
  • Maintenance Health = -5 * 10,000 * 1.05 - (-5 * 10,000)= -$2,500
On other exchanges, one may see:
  • Initial Margin = $5,000
  • Maintenance Margin = $2,500
As a result, Vertex’s perpetuals weightings function similarly to leverage calculations on other platforms:
Perpetuals Leverage Formula

Special Cases: Spreads, LPs, and Large Positions


Spreads can be thought of as positions with offsetting positions on the same underlying asset. Specifically:
  • Long Spread = Long Spot + Short Perpetual (i.e., +10 BTC vs. -10 BTC-Perp)
  • Short Spread = Short Spot + Long Perpetual (i.e., -10 BTC vs. +10 BTC-Perp)
  • User Position: +15 BTC, -10 BTC-Perps
  • Vertex Definition: +10 BTC Spreads, +5 BTC
Given this behavior, spreads are considerably less risky than the spot and perp positions on their own. As such, Vertex has the facility to attribute some health benefits to these positions.

Spread Health

The spread penalty is defined as a separate parameter in the system. The spread weights for longs and shorts are defined (respectively) as:
In most cases where the perp and spot are close to offsetting each other, the health of the spread will be roughly equivalent to the value of the spot component MINUS some small penalty for liquidity considerations.
Spread Health Calculation
Continuing from the user examples above.
  • User Position: +5 BTC, -5 BTC-Perps
  • Spot + Perp Price = $10,000
WITHOUT Spread health benefits:
  • Health = Spot Health + Perp Health
  • Initial Health = $40000 -$5000 = $35,000
  • Maintenance Health = $45000 - $2500 = $42,500
WITH Spread health benefits:
  • User Position: +5 spreads
  • maintenance_spread_penalty = 0.01
  • initial_spread _penalty = 0.02
  • Initial Health = 50,000 - 50000 +50000 - 0.02 * 50000 = $49,000
  • Maintenance Health = 50,000 - 50000 +50000 - 0.01 * 50000= $49,500


Automated market makers (LPs) follow an XY=K market-making formula. Orders match against liquidity in the LP and orderbook – takers get whichever is the best available price.
LP Health:
  1. 1.
    Assume the LP is at equilibrium (i.e., the price implied by LP is the same as the oracle price)[2]. This prevents attacks via the manipulation of the LP price.
  2. 2.
    Decompose the LP into its respective components (continuing to assume an equilibrium state), and add up the health factors from there. For example, BTC-USDC LP becomes a BTC and USDC balance.
  3. 3.
    Apply an additional penalty to the health.
Additional LP Penalty = (1 - LONG_WEIGHT) * AMOUNT_IN_LP * ORACLE_PRICE
This accounts for the additional risk in LPs represented by “impermanent loss” (i.e., the negative convexity). In practice, it means one’s leverage with LPs is halved.
Using the asset weights from above, recall that 5 BTC @ $10,000 price = $40,000 Initial Health.
  • initial_asset_weight (wBTC) = 0.4
  • initial_asset_weight (USDC) = 0.9
  • LP Health = $40,000 * 0.6 = $24,000
LP components are not included in spread balances. For example, if a user owns BTC LP and is short BTC-PERP, there wouldn’t be any spread balance benefit. However, the risk can be thought of similarly, and the risk during liquidation would be treated relatively closely (see below).
1) The equation can also be rearranged as follows:
  • Perp Health = (QuantityProduct*OraclePrice*(1+(AssetWeight -1)) - (QuantityProduct*EntryPrice)
  • Perp Health = QuantityProduct*OraclePrice*(AssetWeight-1) + PnL
Any PnL generated by our position will thus be weighted on a 1:1 basis in our health calculation, allowing traders to leverage positive PnL for further trades but also enforcing de-risking as perp positions go into negative equity.
2) This prevents attacks via manipulation of the LP price.