š„Cross Margin
Last updated
Last updated
Each 100x account can create 256 subaccounts, each of which behaves like a completely discrete account with its own margin.
Each subaccount is cross-margined, where each asset and position they hold contributes to an overall subaccount health. There are two types of health, maintenance and initial.
When a subaccount's initial health drops below 0, they are not allowed to open any positions which reduce their health further (closing positions or swapping to less risky ones).
When a subaccount's maintenance health drops below 0, they become liquidatable, meaning their positions can be forceably closed by liquidators and/or the off-chain engine.
All of a subaccount's asset balances and all open derivative positions are taken into account. The function determines whether a subaccount has any spreads, defined by a short perp position offset entirely by a balance in the same spot asset. The function then calculates and sums the health on each of the spread, spot and derivative positions and deducts any core collateral debt to obtain the subaccount's health. The calculation of each of these constituents is described below:
Perpetual future health is calculated as follows
where quantity is a negative value for short positions.
For example, lets calculate the maintenance health on a 5 BTC-Perp short position that was entered at $38,000. The price of BTC is now $40,000 and the position has earned $500 in funding:
initialLongWeight = 0.9
maintenanceLongWeight = 0.95
initialShortWeight = 1.1
maintenanceShortWeight = 1.05
Because of these weights, there is a limit to the max leverage a subAccount can achieve on an asset:
A balance in any spot asset deemed valid collateral will contribute to a subaccount's health as follows:
For example, for a balance of 5 BTC at $40,000 , if the risk weights are as follows:
initialLongWeight = 0.8
maintenanceLongWeight = 0.9
Note that invalid collateral assets will have weight values of 0.
Spreads are delta-neutral positions where a short perp position in an asset is offset entirely by a spot position in that same asset. Because of this, spreads are less risky than their two constituent components in isolation. We therefore calculate health on spreads using different penalties that are more forgiving to the sub-account.
initialSpreadPenalty = 0.02
maintenanceSpreadPenalty = 0.01
So using the above spot and perp examples, the initial health on this same spread would be:
initialHealth = 5(40000 - 40000 + 38000 - 0.02(40000)) + 500 = $186,500
As calculated above, the initial health on the sum of the two individual positions without spread weightings would be:
So for BTC-Perps, the max initial leverage would be .