Futures mode: cross margin trading
Introduction
Futures mode: In this mode, users can trade across all business lines simultaneously, including spot, margin, futures, perpetual swap, and options. Users only need to transfer assets into the cross margin account. All trading products settled with the same crypto can share the same total margin, and the generated profits and losses can be offset.
The risks of the positions settled with the same crypto will be measured in whole. When the equity of a certain crypto is insufficient, it may result in partial liquidation, full liquidation, or equity loss of all the positions settled with this crypto. If users want to segregate the risk of each position, isolated margin mode will be a good choice.
Asset fields
Term | Explanation | Parameter in Get balance |
|---|---|---|
Equity | Your individual asset balance plus floating PnL from all positions. | eq in the details array |
Free margin | The margin amount of a certain crypto that can be used for trading margins, expiry futures, perpetual futures, and options (short positions) trading. Free margin = Max (0, Crypto balance in cross margin + Floating PnL in cross-margin positions – In use) | availEq in the details array |
Available balance | The amount of crypto that can be used for isolated positions, spot, and options (long positions) trading. Note: This description is for order calculation only and will not be displayed as a field on the platform. | availBal in the details array |
In use | The amount of crypto in the trading account that is in use, which includes cross open orders, positions, accrued interest, isolated open orders, and assets used in trading bots. | frozenBal in the details array |
Floating PnL | The sum of the floating PnL of all margin, futures, and options positions that are settled with a certain crypto, including positions under cross and isolated margin mode. Floating PnL = Floating PnL of cross-margin positions + Floating PnL of isolated margin positions Floating PnL of cross-margin positions = Floating PnL of cross-margin positions + Floating PnL of cross-margin expiry futures positions + Floating PnL of cross-margin perpetual futures positions + Floating PnL of cross-margin options positions Floating PnL of isolated margin positions = Floating PnL of isolated margin positions + Floating PnL of isolated expiry futures positions + Floating PnL of isolated perpetual futures positions + Floating PnL of isolated options positions. | upl in the details array |
Leverage | The leverage of a single crypto, leverage = position value/ (balance in cross positions + floating PnL in cross margin positions). Position value: the sum of position value of all positions that are settled in this crypto Expiry and perpetual futures Position value = face value * |number of contracts| * multiplier / mark price Position value = face value * |number of contracts| * multiplier * mark price Margin Position value = |liability + interest| / mark price Short positions with base crypto as margin and having base crypto as liability. Position value = |liability + interest| Short positions using quote crypto as margin and having base crypto as liability. Position value = |liability + interest| * mark price Long positions using quote crypto as margin and having quote crypto as liability. Position value = |liability + interest| Options | notionalLever in the details array |
Maintenance margin ratio | The index for measuring the risk of a certain asset in the account. | mgnRatio in the details array |
Total equity | The fiat value of all cryptocurrencies in the your account. Total equity = Sum (Crypto equity × Crypto price) The crypto price is based on the USD price of the crypto on OKX. If a crypto does not have a USD price, we will calculate using the spot price of the USDT pair of the crypto multiplied by the price of USDT/USD on OKX. If there is no USDT price, we’ll use the spot price of the USDC pair of the crypto multiplied by the price of USDC/USD on OKX. If there is no USDC price, we’ll calculate according to the spot price of the BTC pair of the crypto multiplied by the price of BTC/USD on OKX. | eqUsd in the details array |
Trading rules
In Futures mode, users can choose to trade in cross margin mode or isolated margin mode. In cross margin mode, all trading products settled with the same crypto can share the same total margin, and the generated profits and losses can be offset. In isolated margin mode, the risk of each position, as well as the profit and loss, are separated.
Trading rules for Futures cross margin mode
When users conduct futures, perpetual, options(short positions), and margin transactions in cross margin mode, the available equity of the crypto in the account should be greater than or equal to the amount required for the order.
When users conduct spot or options(long positions) transactions in cross margin mode, the available balance of the crypto in the account should be greater than or equal to the amount required for the order.
Note: Available balance refers to the amount of assets that can be used to open isolated positions and carry out spot and options (long positions) trading.
If a user's BTC holdings in cross margin positions and open orders are as below:
Underlying | Position type | Direction | Leverage | Position margin (BTC) | Open order margin (BTC) | UPL (BTC) | Position tier MMR |
BTCUSDT Margin | Margin (Isolated) | Long | 5 | 100 | 200 | 10 | 1% |
BTCUSDT Margin | Margin (Cross) | Long | 5 | 100 | 200 | 10 | 1% |
BTCUSD Quarterly | Futures (Cross) | Long | 1 | 10 | 20 | 5 | 1% |
And if the user conducts margin trading in cross margin mode with the holdings as above, the margin verification for placing an order will be as follows:
Then when the user opens a long position with 200 BTC and 5x leverage, the amount of required margin for this order will be 200 / 5 = 40 BTC;
In use = Margin required for futures open orders and positions in cross margin mode + Margin required for margin open orders and positions in cross margin mode + Margin required for open orders in isolated margin mode = 10 + 20 + 100 + 200 + 200 = 530 BTC;
Assuming the user's balance in the cross margin account is 700 BTC.
Free margin = Max (0, balance in cross margin account + floating PnL in cross margin positions - In use) = max(0, 700 + 10 + 5 - 530) = 185 BTC;
If the BTC free margin > the amount of BTC required for the order, it means the order is placed successfully.
If the user conducts the futures trading in cross margin mode with the holdings as above, the order validation for placing an order will be as follows:
If the user longs 100,000 weekly futures contracts with 5x leverage at a price of 10,000 USDT/BTC, the required margin amount = face value * number of contracts * contract multiplier / order price / leverage multiplier = 100000 * 100 * 1 / 10000 / 5 = 200 BTC;
In use = Margin required for futures open orders and positions in cross margin mode + Margin required for margin open orders and positions in cross margin mode + Margin required for open orders in isolated margin mode = 10 + 20 +100 +200 + 200 = 530 BTC;
Free margin = Max (0, balance in cross margin account + floating PnL in cross margin positions - In use) = max(0, 700 + 10 + 5 - 530 ) = 185 BTC;
That is, the BTC free margin is less than the amount required for the order, so the order fails.
Margin positions in cross margin mode
Position fields
Term | Explanation | Parameter in Get position |
|---|---|---|
Assets | The amount of positive assets in the position (does not include margin). | pos |
Available asset | The amount of positive assets to available to close a position. | availPos |
Liability | Initial liabilities + deducted interest | liab |
Interest | Interest that has been accrued but has not been deducted yet. | interest |
Avg. open price | (Existing positions * Entry Price of Existing Positions + New positions * Entry Price of New Positions) / (Quantity of Existing + New positions) Note: When calculating the avg. open price, the amount that was previously closed will not be deducted from the existing position size. This is the difference between futures and margin when calculating the avg. open price. Example: The user opened a 1 BTC long position when the price was 50000 USDT/BTC and partially closed 0.5 BTC. At this point, there is still 0.5 BTC in the position and the avg. open price remains 50000 USDT/BTC. Thereafter, the user increased the position size by 1 BTC when the price was 30000 USDT/BTC. Even though the position is now 1.5 BTC, the avg. open price = (1 * 50000 + 1 * 30000) / (1 + 1) = 40000 USDT/BTC, using 1 BTC as the existing position size instead of 0.5 BTC. | avgPx |
Est. liquidation price | The underlying price when the cross position meets the liquidation conditions. This price only serves as a reference.
| liqPx |
Floating PnL | Unrealized profit or loss of the current position. Calculation formula: Floating PnL = Total assets - (liability + interest) / mark price
Floating PnL = Total assets * mark price - (liability + interest)
Floating PnL = total assets - (liability + interest) * mark price
Floating PnL = Total assets / marked price - (liability + interest) | upl |
Floating PnL % | Floating PnL / Initial margin | uplRatio |
Initial margin | Long positions using base crypto as margin and having quote crypto as liability. Initial margin = (liability + interest) / (mark price * leverage)
Initial margin = (liability + interest) / leverage
Initial margin = (liability + interest) * mark price / leverage Long positions using quote crypto as margin and having quote crypto as liability. Initial margin = (liability + interest) / leverage | imr |
Maintenance margin | Long positions using base crypto as margin. Maintenance margin = (liability + interest) * position tier maintenance margin ratio / mark price Long positions using quote crypto as margin. Maintenance margin = (liability + interest) * position tier maintenance margin ratio Short positions using quote crypto as margin. Maintenance margin = (liability + interest) * position tier maintenance margin ratio * mark price Short positions using base crypto as margin. Maintenance margin = (liability + interest) * position tier maintenance margin ratio | mmr |
Initial margin
Both tokens of a pair can be used as margin for long/short positions.
Example:
When trading the BTC/USDT pair, you can choose either BTC or USDT as the margin crypto to open long/short margin positions in cross mode.
Assuming you open a long position of 1 BTC using 10x leverage and use BTC as the margin crypto, a margin of 0.1 BTC is required (the free margin in account should be greater than or equal to 0.1 BTC), the filled price is 10,000 USDT/BTC, and 10,000 USDT needs to be borrowed; no borrowings or interest will be incurred if the order has not been filled but the margin will be in use.
After the order is filled, a long position will be opened: the total asset of this position will be 1BTC, while its liability is 10,000 USDT. The margin of 0.1 BTC will remain in the account balance, and will not be transferred to the position asset (It is different from isolated position, where margin for isolated position will be transferred into the position).
Closing positions
Position assets and margin are using the same crypto
Long positions using base crypto as margin, and having quote crypto as liability.
Short positions using quote crypto as margin and having base crypto as liability.
Principle of closing positions: Only the available asset can be used for closing a position. Users can close the position when they pay off the liability; Users can also choose whether to use "reduce only" when closing a position.
The available asset formula for closing positions:
In cross margin mode, the available asset that can be used for closing the position may be the sum of total position asset and part of the equity in account balance.
Fundamentally, closing a margin position cannot affect the risks of other positions in cross margin mode. When the total equity is greater than or equal to the initial margin required for the coin, the available asset for closing a margin position can include the initial margin of this position; when the equity is less than the initial margin required for the coin, the available asset for closing a margin position can include the maintenance margin of this position.
Closing long positions with liability calculated in quote crypto:
Coin equity ≥ coin initial margin, the available asset for closing margin positions = (|liability + interest| of this margin position) * (1 + IMR% of this margin position) / mark price
Coin equity < coin initial margin, the available asset for closing margin positions = (|liability + interest| of this margin position) * (1 + MMR% of this margin position) / mark price
Closing short positions with liability calculated in base crypto:
Coin equity ≥ coin initial margin, the available asset for closing margin positions = (|liability + interest| of this margin position) * (1 + IMR% of this margin position) * mark price
Coin equity < coin initial margin, the available asset for closing margin positions = (|liability + interest| of this position) * (1 + MMR% of this position) * mark price
No. | Mode | Closing method | Rule | Example |
1 | Close in Position | Market close all | 1. Only pay off the liabilities, and the remaining assets will be transferred to the account balance. | User has a long position with available assets 2 BTC, liability 10,000 USDT, and interest 10 USDT. |
Using a limit order | 1. You can buy assets that exceed the liabilities. Once the liability is paid off, the margin position will be closed. The oversold assets and remaining ones will be transferred to the account balance. | User has a long position with available assets 2 BTC, liability 10,000 USDT, and interest 10 USDT | ||
2 | Close in order placement area | Reduce only | The same as those of [Close in Position] | - |
Reduce + reverse position | 1. When the liability is paid off, the margin position will disappear. The oversold asset will be used to open a reverse position; | User has a short position with available assets 30,000 USDT, liability 2 BTC, with interest and transaction fees temporarily ignored. |
Position assets and margin are using different crypto
Short positions with base crypto as margin and having base crypto as liability.
Long positions using quote crypto as margin and having quote crypto as liability.
Principle of closing positions: Only position assets can be used to close a position. When the position assets are completely sold, the position will be closed. If the liability is not paid off, the equity in the account will be used to directly pay off the remaining liabilities; Users can choose whether to use "reduce only". The available asset that can be used to close the position = position assets.
No. | Mode | Closing method | Rule | Example |
1 | Close in Position | Market close all | 1. The position will be closed when all position assets are sold at market price. | User has a long position with available assets 2 BTC, liability 10,000 USDT, with interest and fees temporarily ignored.Its margin crypto is USDT, and its margin is in USDT account balance. |
Using a limit order | 1. The position will be closed when all position assets are sold at limit price. | User has a long position with available assets 2 BTC, liability 10,000 USDT, with interest and fees temporarily ignored.Its margin crypto is USDT, and its margin is in USDT account balance. | ||
2 | Close in order placement area | Reduce only | The same as those of [Close in Position] | - |
Reduce only + reverse position | 1. The position will be closed when all position assets are sold. The remaining assets will be used to open a reverse position; | User has a short position with available assets is 30,000 USDT, liability 2 BTC, with interest and fees temporarily ignored. |
Expiry and perpetual futures in cross margin mode
In cross margin mode, both Hedge mode and One-way modes are supported.
Position fields
Term | Explanation | Parameter in Get position |
|---|---|---|
Total | For the one-way mode, the total of long positions is a positive number, and the total of short positions is a negative number. | pos |
Avail. | Only shown in Hedge mode | availPos |
Floating PnL | Unrealized profit or loss of current position Floating PnL of long positions = face value * |number of contracts| * multiplier * (1 / avg. open price – 1 / mark price) Floating PnL of short positions = face value * |number of contracts| * multiplier * (1 / mark price – 1 / avg. open price) USDT-margined Floating PnL of long positions = face value * |number of contracts| * multiplier * (mark price – avg. open price) Floating PnL of short positions = face value * |number of contracts| * multiplier * (avg. open price - mark price) | upl |
Floating PnL % | Floating PnL / initial margin | uplRatio |
Initial margin | Crypto-margined Initial margin = face value * |number of contracts| * multiplier / (mark price * leverage) USDT-margined Initial margin = face value * |number of contracts| * multiplier * mark price / leverage | imr |
Maintenance margin | Crypto-margined Maintenance margin = face value * |number of contracts| * multiplier * position tier maintenance margin ratio / mark price USDT-margined Maintenance margin = face value * |number of contracts| * multiplier * position tier maintenance margin ratio * mark price | mmr |
Options in cross margin mode
In mode, you will be able to open long and short positions of options
Position fields
Term | Explanation | Parameter in Get position |
|---|---|---|
Total | The total of long positions is a positive number, and the total of short positions is a negative number. | pos |
Options value | If the unit for calculating the price is crypto, then options value = total positions * mark priceIf the unit for calculating the price is the number of contracts, then options value = total positions * mark price * multiplier | optVal |
Floating PnL | Unrealized profit or loss of current position Floating PnL = (mark price - avg. open price) * total positions * multiplier | upl |
Floating PnL % | Floating PnL % = (mark price – avg. open price) / avg. open price Floating PnL % = (avg. open price - mark price) / avg. open price | uplRatio |
Initial margin | The initial margin for long positions is 0. Information on how to calculate the initial margin for short positions can be found here. | imr |
Maintenance margin | The maintenance margin for long positions is 0. Information on how to calculate the maintenance margin for short positions can be found here. | mmr |
Risk assessment
The Futures Mode's cross margin mode applies a double-layer risk assessment measure. The first layer is "order cancellation by risk control system", and the other is "pre-liquidation verification". This measure ensures a smooth trading experience, prevents the open orders from being completely canceled, and prevents the positions from being partially or even fully liquidated due to insufficient margin.
Order cancellation by risk control system
If a user's account is assessed as risky but not risky enough to trigger "pre-liquidation verification", the" order cancellation by risk control system" will be executed, and some open orders will be canceled to ensure the account stays within a safe risk control level, which can prevent the open orders from being canceled because of a sudden triggering of "pre-liquidation verification".Rules for "order cancellation by risk control system" in margin mode
When (Available equity of the crypto in trading account - used balance) < the required maintenance margin for all the positions + the initial margin for the open orders of opening positions in cross margin mode + the open orders fees, all the open orders that will increase the used equity amount will be cancelled. (Including the opening orders of futures, perpetual, options, and margin in both cross margin and isolated margin mode, as well as the open orders for selling the crypto).
When the available balance <0, all open orders in isolated margin mode, open orders for selling the crypto, and options buy orders will be canceled.
Pre-liquidation verification
The liquidation that happens in futures mode is triggered depending on whether or not the maintenance margin ratio reaches 100%. In the cross margin mode, the maintenance margin ratio is an indicator calculated from the cross margin account equity and maintenance margin in a certain crypto. Generally, the higher the account equity, and the lower the maintenance margin, the lower the risk.
When the maintenance margin ratio of a certain crypto in cross margin mode is < 300%, the system will send a liquidation alert to the account, warning users of the risk of liquidation. 300% is set as the pre-alert parameter, and OKX reserves the right to adjust this parameter according to the actual situation.
When the maintenance margin ratio of a certain crypto in cross margin mode is <= 100%, the system will cancel the orders according to the following rules, that is, order cancellation by pre-liquidation system:
Business line | Mode | Cross margin |
|---|---|---|
Expiry and perpetual futures | Hedge mode | Cancel all unfilled open orders (including algo orders) in cross margin mode, the limit orders and stop-loss orders of opening positions in isolated margin mode; the stop-loss orders of closing positions in isolated margin mode and algo orders except stop orders in isolated margin mode will not be canceled. |
One-way mode | Cancel all unfilled open orders (including algo orders) in cross margin mode, and the limit orders of opening positions in isolated margin mode; algo orders in isolated margin mode will not be canceled. | |
Margin | - | Cancel all unfilled open orders (including algo orders) in cross margin mode, and the limit orders with the same direction of current positions in isolated margin mode; algo orders in isolated margin mode will not be canceled. |
Options | - | Cancel all unfilled open orders in cross margin mode and orders of opening positions in isolated margin mode. |
If the maintenance margin ratio is still <= 100% after the orders are canceled, the account will trigger a liquidation.The partial liquidation process can be divided into two phases. In each stage, the positions to be partially liquidated will be handed over to the liquidation engine at the mark price, and a certain amount of maintenance margin will be charged (It is determined by your position tier, which will make up for the loss of the liquidation engine, and the remaining will be injected into the security fund, which will not get additional liquidation fee). The option long position will not be partially liquidated.
There are 2 phases of partial liquidation:
1. Liquidation will start with positions of the same contracts in the opposite direction under hedge mode.
2. When there is no position described in 1), or all positions described in 1) are liquidated, and liquidation risks have not been reduced significantly, the system will continue to liquidate the remaining positions, according to predefined business-line priorities:
Perpetual Futures & Expiry Futures - Margin Spot - Options
Within each business line, the system ranks all positions based on market liquidity. Positions with better liquidity will be liquidated first. Each time the position gets partially liquidated, the position tier will be reduced by one level until the liquidation risks have been reduced significantly.
For example, suppose an account’s current maintenance margin ratio to drop to 98%, triggering the forced position liquidation condition.
After the system completes the pre-liquidation order cancellations, the account’s maintenance margin ratio rises to 99%, entering the liquidation process.
Under hedge mode, the system detects that the account holds hedged positions under Index A (contract).The system will prioritize the reduction of positions under Index A:
Reduce both the long and short positions under Index A simultaneously.
After liquidation, the position under Index A becomes single-sided.
Upon completion of the above steps, the system recalculates the maintenance margin ratio. If the account risk still has not recovered to a safe level and there are no opposite positions remaining in the account, the system enters the next stage.
At this stage, the account still holds open positions. The system will then determine which positions to reduce according to the predefined business-line priority. Since Contract C has better market liquidity than Contract B, the system will prioritize reducing the position in Contract C. If the account still remains at liquidation risk after this reduction, the system will continue selecting the next position to reduce following the same rules, and will progressively execute further reductions until the risk level is brought back to a safe level.
When the liquidation results in negative assets, the system will use the security fund to offset your negative assets, and a corresponding bankruptcy loss bill will be generated at this time.
Digital asset holdings, including stablecoins, involve a high degree of risk, can fluctuate greatly, and can even become worthless. Leveraged trading in digital assets magnifies both potential gains and potential losses and could result in the loss of your entire investment. Past performance is not indicative of future results. You should carefully consider whether trading or holding digital assets is suitable for you in light of your financial condition, particularly if considering the use of leverage. You are solely responsible for your trading strategies and decisions, and OKX is not responsible for any potential losses. Not all products and promotions are available in all regions. For more details, please refer to the OKX Terms of Service and Risk & Compliance Disclosure.
© 2024 OKX. All rights reserved.