Account Margin Management

browse

This article provides the necessary formulas and explanations to calculate and manage the margin requirements of your leveraged derivatives and spot margin positions. 

 

Definitions and Formulas

Term

Definition

Formulas

Total Account Value

Total value of the collateral and unrealized PnL within a specific subaccount.

Total Account Collateral + Unrealized PnL

Position Notional

Notional size of your position in USD

Position size * Market price

Margin Fraction (MF)

Fraction of Total Account Value vs Total Position Notional in the subaccount

Total Account Value / Total Position Notional

IMF Factor

Multiplier assigned to each asset on FTX. It is set based on factors such as liquidity or market capitalization.

See values here.

IMF Weight

Multiplier of the margin required to open a new leveraged position

See values here.

MMF Weight

Multiplier of the margin required to maintain an existing leveraged position

See values here.

Max Leverage

Max allowable leverage to open new derivatives or spot margin positions set by the user.

A subaccount's max leverage can be adjusted on the profile page under the Margin section.


Max allowable leverage on spot margin is 10x.

Base IMF

The minimum Initial Margin Fraction needed to open a new perpetual swap or futures position.

1 / Maximum account leverage set by user

Position Open Size

The maximum Total Position Size if your outstanding long or short orders were filled.

MAX (ABS [position size + open long orders], ABS [position size - open short orders] )

Position Open Size Notional

Notional value in USD of your position, including open orders.

Position Open Size * Mark Price

Total Open Position Notional

The total notional amount in USD of all open derivatives or spot margin positions that haven’t been filled yet.

SUM (Position Open Size1 * Mark Price1, Position Open Size2 * Mark Price2, …)


For all positions

Collateral Used

Collateral currently being used by a single derivatives or spot margin position

Position IMF * Position Notional

Total Collateral Used

Total of collateral being used by all open derivatives or spot margin positions in the subaccount, as well as collateral tied up in open orders, including spot.

= sum (Position1 Open Size Notional * Position1 IMF, Position2 Open Size Notional * Position2 IMF,...) + sum(Spot Order1 Size * Mark Price, Spot Order2 Size * Mark Price,...)

Free Collateral

Total collateral available that can be used for opening new positions and withdrawn from the exchange, excluding collateral locked in open orders or open positions.

Total Account Collateral - Total Collateral Used

Position Initial Margin Fraction

(Position IMF)

The minimum margin fraction required for a particular derivatives position. 

max(Base IMF , IMF Factor * sqrt [position open size in tokens]) * IMF Weight

Position Maintenance Margin Fraction

(Position MMF)

The minimum margin fraction required to avoid liquidation on a derivatives position

max(3%, 0.6 * IMF Factor * sqrt [position open size in tokens]) * MMF Weight

Spot Margin Base IMF

Needed to calculate the minimum margin fraction required for a particular position. 

If borrowing USD:

= 1 / max account leverage

If borrowing non-USD assets (e.g. BTC)

 = max ( 1 / max account leverage, 1.1 / Total Weight - 1 )


(See asset’s Total Weight here)

Spot Margin IMF

The minimum margin fraction required to open a spot margin position, applicable to positions of all sizes. 

= max( Spot Margin Base IMF, IMF factor * sqrt [position size in tokens] ) * IMF Weight

Spot Margin MMF

The minimum margin fraction required to avoid liquidation on a spot margin position

If borrowing USD: 

= 3%


If borrowing non-USD assets (e.g. BTC)

 = max ( 1.03 / Total Weight - 1, 0.6 * IMF factor * sqrt [position size in tokens] ) * MMF Weight

Account Initial Margin Fraction

(Account IMF)

The minimum account margin fraction required to increase position size, equal to average of position IMF for all account positions weighed by position open notional

Sum ( [ Position Notional / Total Position Notional ] * Position IMF )


of all derivatives and spot margin positions in subaccount

Account Maintenance Margin Fraction

(Account MMF)

The minimum account MF needed to avoid getting liquidated, equal to average of positions MMF weighed by the positions notional.

Sum ( [ Position Notional / Total Position Notional ] * Position MMF )


of all derivatives and spot margin positions in subaccount

Auto Close Margin Fraction

(ACMF)

The minimum margin fraction needed to avoid the assets and positions of a given sub being liquidated via backstop liquidity providers.

max( Account MMF / 2, Account MMF - 0.06 )

Open Margin Fraction

Your current margin fraction, including open positions and open orders (derivatives and spot margin). If OMF = IMF, you can’t open more positions.

MAX (0, MIN [Total Account Value, Collateral] ) / Total Open Position Notional

Zero Price (ZP)

This is the mark price (MP) that would set a subaccount’s Total Account Value to 0.

Mark Price * (1 - Margin Fraction) if long, Mark Price * (1 + Margin Fraction) if short. 

Position Margin Per Dollar (PMPD)

Used for calculating Position Zero Price (PZP)

[(Position maintenance collateral used) / (sum of Position maintenance collateral used for all account positions)] * Total account value / abs(position notional)

Position Zero Price (PZP)

The fill price a bankrupted account would receive for a particular position.

MP * (1 - PMPD) if long, MP * (1 + PMPD) if short

Unused Collateral

Total collateral available that can be used for opening new positions and withdrawn from the exchange, including open orders.

max(OMF - IMF, 0) * total open position notional

Mark Price (MP)

Median of best bid, best ask, and last traded price (LTP).

If futures market is paused

= median(best bid, best offer, last traded price)

If futures market is not paused

= index price + (LTP - index price)

 

Examples

This example will walk you through the terms and formulas presented above, and calculate how much margin is required to open new derivatives and spot margin positions, and also determine at which margin fraction the positions and account would be liquidated.

Assume that your subaccount has $50,000 USD and 2.5 BTC in collateral, max leverage has been set to 10x, and also spot margin has been enabled. We will open the following positions in this order and finalize the example by calculating our Account IMF and MMF:

  1. Buy BTC-PERP (long)
  2. Short LTC/USD using spot margin
  3. Sell ETH-9030 (short)

Opening and Managing a Futures Position

Before opening the 20 BTC-PERP long position, here’s an overview your account's collateral. 

Total Account Value

The account has the following in collateral:

  • USD = $50,000
  • BTC = 2.5 ($50,000 at current prices assuming BTC/USD is trading at $20,000)
  • Total collateral value (in USD) = $100,000

In theory, your total collateral value in USD is $100,000 when we add up the USD and the current value of the BTC balance. However, FTX accepts a wide variety of non-USD assets as collateral, and each of them have different collateral weights for opening new positions and managing existing positions (more info here).

In the case of BTC, it has an initial collateral weight of 0.95, which means that for opening new positions, your 2.5 BTC would be worth $47,500 rather than the full $50,000 after applying the haircut. However, since spot margin is enabled for this subaccount, BTC’s total weight of 0.975 will be used to determine the value of your collateral to open new positions, as well as when the position is already open once the position is opened (if spot margin is disabled, Total Weight is only used for the latter).

Therefore, the total unused collateral available for opening new positions is $97,500. Here's a full overview of the account's collateral:

Collateral Overview

Collateral

USD

BTC

Total

Amount

50,000

2.5

50,003

Mark Price

$1

$20,000

-

USD Amount

$50,000

$50,000

$100,000

Initial Weight

1

0.95

-

Initial Collateral

$50,000

$47,500

$97,500

Total Weight

1

0.975

-

Total Collateral

$50,000

$48,750

$98,750

 

Calculating IMF - Determining how much collateral/margin is needed to open a position

To calculate the Initial Margin Fraction for the BTC-PERP position, we use the following formula:

Position IMF = MAX (Base IMF , IMF Factor * sqrt [position open size in tokens] * IMF Weight

= MAX (1/10 , 0.002 * sqrt [20] ) * 1

= MAX (0.1 , 0.004)

= 0.1 = 10%

So if we want to go long 20 BTC-PERP and each BTC-PERP is trading at $20,000, for a Position Notional of $400,000, we will need at least $40,000 in collateral to open the position.

The account has enough collateral, so we go ahead and open the position.

Note about factors that influence IMF:

Keep in mind that your position’s IMF can increase (i.e. reducing your max leverage to open that position) based on the factors included in the formula, including position size, IMF factor, and IMF weight.

As an example, imagine you’re trying to open a 5000 BTC-PERP long position worth $100,000,000 (assuming BTC-PERP is trading at $20,000). Using the same formula:

Position IMF = MAX (1/10 , 0.002 * sqrt [5000] ) = MAX (0.1 , 0.141 )

Position IMF = 0.141 = 14.1%

So, even though your max leverage is 10x (making your Base IMF 10%), because you are trying to open a large position worth $100,000,000, your initial margin requirement increases to 14%.

 

Managing Position - Calculating Maintenance Margin Fraction

After opening the 20 BTC-PERP position, your Margin Fraction is as follows:

= Total Account Value / Total Position Notional

= $98,750 / $400,000

= 24.69%

Now, let's calculate your Maintenance Margin Fraction to understand at which point the position would start getting liquidated (assuming that’s the only open position in the account. We will explore how multiple positions affect your account's MMF and IMF later on in this example).

MMF = max(3%, 0.6 * IMF Factor * sqrt [position open size in tokens]) * MMF Weight

= max (3%, 0.6 * 0.002 * sqrt[20] )) * 1

= 3%

 

Opening and Managing Spot Margin Position

Next, we’re now going to short 200 LTC on the LTC/USD market using spot margin. Keep in mind that IMF formula for spot margin positions is different than the formula for derivatives.

 

Calculating Spot Margin IMF

Because you're shorting LTC, that means that you're going to borrow LTC in order to sell it. When borrowing non-USD assets, the Spot Margin Base IMF formula is as follows:

= max ( 1 / max account leverage, 1.1 / Total Weight - 1 )

= max (0.1, 1.1 / 0.95 - 1)

= 15.79%

Now that we know the Base IMF, we can go ahead and calculate the Spot Margin Position's IMF:

= max( Spot Margin Base IMF, IMF factor * sqrt [position size in tokens] ) * IMF Weight

= max (15.79%, 0.0004 * sqrt [200] ) * 1

= max (15.79%, 0.4%)

= 15.79%

This means that we need $1,579 in collateral in order to open the 200 LTC spot margin short.

 

Calculating Spot Margin MMF

Because you’re borrowing LTC in this case and not USD, we use the following formula:

= max ( 1.03 / Total Weight - 1, 0.6 * IMF factor * sqrt [position size in tokens] ) * MMF Weight

= max ( 1.03 / 0.95 - 1, 0.6 * 0.0004 * sqrt [200] )

= max (5.64%, 0.34%)

= 5.64%

 

Calculating Free Collateral

Let's see how much collateral your two positions are currently taking up and ultimately how much free collateral there is in the account for opening another position.

Starting with the 20 BTC-PERP, assuming each BTC-PERP is still trading at $20,000, this is how much collateral the position is currently taking up:

Collateral Used = Position IMF * Position Notional

= 10% * $400,000

= $40,000

The same is done with the LTC/USD spot margin short:

= 15.79% * $10,000 = $1,579

 

How Spot Margin positions affect collateral and margin

By opening the 200 LTC/USD spot margin short, you are borrowing 200 LTC, which creates a negative spot balance of -200 LTC. In addition to requiring margin, negative spot positions also decrease your account collateral value (more information can be found in this article). Also, because you essentially sold 200 LTC at a price of $50, your USD balance also increased by $10,000.

This is how your balance currently looks after opening the BTC-PERP and LTC/USD spot margin positions:

Current Collateral Overview

Asset

Size

Mark Price

Initial Weight

Initial Collateral

Total Weight

Total Collateral

USD

60,000

$1

1

$50,000

1

$50,000

BTC

2.5

$20,000

0.95

$47,500

0.975

$48,750

LTC (borrow)

-200

$50

-

-$10,000

-

-$10,000

Total Collateral

49,803

-

-

$97,500

-

$98,750

Now, let’s see how much free collateral there is currently on the account:

Market

Position Size

Mark Price

Position Notional

IMF %

MMF

Collateral Used

BTC-PERP

20

$20,000

$400,000

10%

3%

$40,000

LTC/USD

200

$50

$10,000

15.79%

5.64%

$1,579

Total (sum)

220

-

$410,000

-

-

$41,579

 

Total Collateral

$98,750

Total Collateral Used

$41,579

Free Collateral

$57,171

This means that there is $47,468 in free collateral after deducting the amount of collateral being used by your open positions, as well as the negative balance from our LTC/USD spot margin short.

 

Before calculating the Account IMF and MMF, let’s long 25 ETH-0930 contracts using the remaining free collateral in the subaccount. Assuming each contract is trading at $2000, the Position Notional would be $50,000.

Same as before, let’s calculate the Position IMF:

= MAX (1/10 , 0.0004 * sqrt [25] ) * 1

= MAX (0.1 , 0.002 )

= 0.1 = 10%

That means there must be at least $5,000 in inventory in order to open the position. There is enough collateral, so we go ahead and position the position. Now, let's calculate the position's MMF.

Position MMF:

= max (3%, 0.6 * 0.0004 * sqrt[25] )

= 3%

 

Account IMF and Account MMF

At this point, we have 3 positions open, equalling to a Total Position Notional of $460,000. The Total Account Value remains at $98,750 (we're assuming prices haven't changed at all).

 

Calculating Account IMF and Account MMF

These will be equal to the average IMF/MMF of all our open positions within the subaccount, weighted by their position notional size.

To do that, we first calculate the Weighted IMF and MMF for each position:

= (Position notional / total position notional) * Position IMF or MMF

As an example, let’s calculate the Weighted IMF for our BTC-PERP position:

= ($400,000 / $460,000) * 10%

= 8.7%

After we calculate that for each of the positions, we then sum the results. Here’s the final result:

Market

Position Size

Mark Price

Position Notional

IMF %

MMF

Collateral Used

Weighted IMF

Weighted MMF

BTC-PERP

20

$20,000

$400,000

10%

3%

$40,000

8.70%

2.61%

LTC/USD

200

$50

$10,000

15.79%

5.64%

$1,579

0.34%

0.12%

ETH-0930

25

$2,000

$50,000

10%

3%

$5,000

1.09%

0.33%

Total (sum)

245

-

$460,000

-

-

$46,579

10.13%

3.06%

Here’s a summary of our account after opening the three positions:

Total Collateral

$98,750

 

Margin Fraction

21.47%

Total Collateral Used

$46,579

 

Account IMF

10.13%

Free Collateral

$52,171

 

Account MMF

3.06%

Once your subaccount's Margin Fraction dips below 3.06%, liquidation will start. More information about how FTX handles liquidations can be found here.

 

Auto-Close Margin Fraction (ACMF)

ACMF is the margin fraction at which your account would be completely liquidated. To calculate this, we use this formula:

ACMF = max(MMF / 2, MMF - 0.06)

= max( 0.036 / 2, 0.036 - 0.06 )

= 1.53%

So, if your Margin Fraction drops below 1.53%, all of your positions within the subaccount would be instantly liquidated.

 

Zero Price

Zero Price (ZP) is the price that would cause your account to get completely liquidated.

ZP = Mark Price * (1 - Margin Fraction) if long, Mark Price * (1 + Margin Fraction) if short. 

For each of your positions:

BTC-PERP Long = $20,000 * (1 - 21.47%) = $16,141

LTC/USD Short = $50 * (1 + 21.47%) = $60

ETH-0930 Short = $2000 * (1 + 21.47%) = $1,614

 

Open Orders & Open Margin Fraction

In all of the examples above, we had no open (unfilled) orders before we tried to open new positions. Open orders affect your free collateral and margin, so it’s important to understand the role they play here. To do this, let’s calculate your Open Margin Fraction.

Let’s assume your 3 positions are still open and prices have not changed at all, which means that your Free Collateral is still $52,171.

Now, we’re going to open the following BTC-PERP limit orders:

  • Long 2 BTC-PERP @ $19,500 ($39,000 notional)
  • Sell 5 BTC-PERP @ $21,000 ($105,000 notional)

To start, let’s calculate the Open Position Size:

= MAX (ABS [position size + open long orders], ABS [position size - open short orders] )

= MAX ( ABS [20 + 2] , ABS [20 - 5] )

= 22

Using the current mark price for BTC-PERP, we calculate the Position Open Notional:

= Open Position Size * Mark Price

= 22 * $20,000

= $440,000

 

Then, we aggregate all open orders and open positions in the subaccount to calculate the Total Open Position Notional:

Position Open Notional:

  • BTC-PERP = $440,000 (includes our Open Position Size, as explained in the example above)
  • LTC/USD = $10,000 (no open orders here, so stays the same)
  • ETH-0930 = $50,000 (no open orders here, so stays the same)

Total Open Position Notional = $500,000

 

Now, using what we calculated above, let’s calculate the Open Margin Fraction (OMF):

= MAX (0, MIN [Total Account Value, Collateral] ) / Total Open Position Notional

= MAX (0, MIN [$98,750, $98,750] ) / $500,000

= $98,750 / $500,000

= 19.75%

The OMF (your Margin Fraction with open orders included) is 19.75%. The Account IMF is 10.13%, which means that you can still open more positions.



Notes:

  • sum(value1, value2,..) = sum total of the values within the data set provided
  • max(value1, value2,..) = the maximum value within the data set provided
  • min(value1, value2,..) = the minimum value within the data set provided
  • abs(value) = the absolute value of the data provided
  • Open position means that the position has been filled and has not been closed yet. Open order means that that the order has been submitted, but has not been filled yet.
  • Mark price = median of best ask, best bid, and last traded price.
  • Your margin and collateral is segregated per subaccount. Therefore, throughout this article, account = subaccount. 
  • Much of this article is an approximation and ignores details, e.g. fees.
Previous
Next
360027946371
Didn't find what you were looking for?
Create a support ticket
Community

Was this article helpful?

1 out of 1 found this helpful