LogoLogo
  • Getting Started
    • ๐Ÿ“‹Overview
    • ๐Ÿ“œTable of Contents
    • โš”๏ธVertex Edge
  • Basics
    • ๐ŸŽฅProducts
    • โšกDEX Architecture & Design
    • ๐ŸงตUnified Cross-Margin
    • โœ‚๏ธIsolated Margin
    • โ„น๏ธSubaccounts, Isolated Margin, and Health
    • โฐLiquidations & Insurance Fund
    • ๐Ÿ’ธPnL Settlements
    • ๐Ÿ“ŠPricing (Oracles)
    • ๐Ÿ’ฐFees
    • ๐Ÿ“ˆFunding Rates
    • โš–๏ธPerpetual & Spot Market Specifications
    • โ˜‘๏ธOne-Click Trading
    • ๐Ÿ”ซTrigger Orders
    • โ”FAQs
  • Rewards
    • ๐Ÿ…Points & Gold
    • ๐Ÿ“ˆTrading Competition
  • Resources & Links
    • ๐Ÿ“–Glossary
    • ๐Ÿ”ฌOpen-Source Contracts
    • ๐Ÿ“ŠData Providers & Metrics
    • ๐ŸชŸMaintenance Windows & Status
    • ๐ŸTerms of Use
    • ๐Ÿ”Privacy Policy
    • ๐ŸŒŽRestricted Territory Updates
    • ๐Ÿ“ธMedia Kit (Brand Assets)
  • Tutorials
    • ๐ŸGetting Started
    • โ˜‘๏ธOne-Click Trading
    • ๐Ÿ“ฌTrading Basics
    • ๐Ÿ”ดPerpetual Trading
    • ๐Ÿท๏ธSpot Trading
    • ๐Ÿ‘ฏMultiple Accounts
    • โš”๏ธCross-Chain Deposits
    • ๐Ÿ”ŒTP, SL & Stop-Market Orders
    • ๐Ÿ”ฑDepositing & Withdrawing
    • โšกFast Withdrawals (Coming Soon)
    • ๐Ÿ”„Borrowing & Repaying
    • ๐ŸšงMargin Health
    • ๐ŸŽฑPools
  • Developer Resources
    • ๐Ÿ”ŒAPI
    • ๐ŸŒถ๏ธTypeScript SDK
    • ๐ŸPython SDK
    • ๐Ÿ‘ฝRust SDK
    • ๐Ÿ—๏ธContracts
Powered by GitBook
On this page
  • Subaccounts โ€“ Unified Cross Margin by Default
  • Isolated Margin
  • Health
  • Health Types
  • Assets
  • Weight Parameters
  • Spot Health
  • Perpetual Health
  • Special Cases: Spreads, LPs & Large Positions
  • Spreads
  • Spread Health
  • LPs
  1. Basics

Subaccounts, Isolated Margin, and Health

Defining Blitz's subaccount model and weighted margin calculations.

PreviousIsolated MarginNextLiquidations & Insurance Fund

Last updated 2 months ago

Subaccounts โ€“ Unified Cross Margin by Default

Each address on Blitz can open an arbitrary number of subaccounts, which Blitz 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 Blitz apply unified cross-margin. The benefits include:

  • Capital efficiency.

  • Lower risk of liquidation on positions.

  • Ability to easily compound profits.

To learn more about Blitzโ€™s Unified Cross-Margin, click .


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.

Blitz traders can now use isolated margin for perpetuals, independently of their unified cross-margin positions โ€” all within the same account.

Learn more details about Isolated Margin on Blitz here.


Health

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 liquiditaed 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:

  1. Maintenance Health: If Maintenance Health < 0, accounts can be liquidated.

  2. Initial Health: If Initial Health < 0, accounts cannot open new positions.

In the parlance of other exchanges:

Maintenance Health โ‰ˆ USDB to Liquidation

Initial Health โ‰ˆ Free Collateral

Assets

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:

  1. maintenance_asset_weight

  2. maintenance_liability_weight

  3. initial_asset_weight

  4. 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 Blitz. For example, tokens deposited into Blitzโ€™s smart contracts can be used to trade other assets. Their contribution to health can be calculated as follows:

Example:

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

Therefore:

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 Blitz. Perpetuals on Blitz are also subject to variable funding rates that tether the price to the underlying spot asset.

Given their embedded leverage, perpetuals have a similar but slightly different calculation for health:

Example:

A user decides to short 5 BTC-PERP, and the price is $10,000. Letโ€™s calculate the initial and maintenance health:

  • maintenance_asset_weight = 0.95

  • maintenance_liability_weight = 1.05

  • initial_asset_weight = 0.9

  • initial_liability_weight = 1.1

Therefore:

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, Blitzโ€™s perpetuals weightings function similarly to leverage calculations on other platforms:


Special Cases: Spreads, LPs & Large Positions

Spreads

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)

Example:

User Position: +15 BTC, -10 BTC-Perps

Blitz Definition: +10 BTC Spreads, +5 BTC

Given this behavior, spreads are considerably less risky than the spot and perpetual 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:

1 - SPREAD_PENALTY and 1 + SPREAD_PENALTY

In most cases where the perpetual 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.

Example:

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

LPs

Automated market makers (LPs) follow an X * Y = K market-making formula. Orders match against liquidity in the LP and orderbook โ€“ takers get whichever is the best available price.

LP Health:

  • 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.

  • Decompose the LP into its respective components (continuing to assume an equilibrium state), and add up the health factors from there. For example, a BTC-USDB LP becomes a BTC and USDB balance.

  • 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.

Example:

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 (USDB) = 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 perpetual positions go into negative equity.

2) This prevents attacks via manipulation of the LP price.

For details on funding rate calculations for perpetuals, skip to the section covering the topic .

03/11/2024: wBTC is used as an example above for LP Health but won't initially be available upon the Blitz launch. For full Blitz market specifications, please refer to the Perpetual & Spot Market Specifications section .

here
here
here
โ„น๏ธ
Spot Health Formula
Perpetual Health Formula
Perpetuals Leverage Formula
Spread Health Calculation
Page cover image