What is Order Cost?
Order Cost refers to the expenses associated with executing trades, including Initial Margin (1/Leverage * Entry Order Value) and Trading Fees.
How to Calculate Order Cost?
Order Cost = 1/Leverage * Entry Order Value + (Entry Order Value + Bankruptcy Value) * Taker Fee
- Taker Fee depends on the contract. Refer to the Fees page to check each contract's fee rate.
- If you're using Cross Margin (0x Leverage), you'll need to enter the Max Leverage for that contract. You can find what the Max Leverage is on the Contracts Guide page.
- If the expected Liquidation Price of your position is lower than the Mark Price, the position will be liquidated at the time of the execution due to the current Mark Price status. This means Sell Premium must be added to the Order Cost calculation in order to open a position like that. Sell Premium is calculated as:
Sell Premium = Max(0, Entry Order Value - ABS(Entry Order Value * (1/Leverage - (Maintenance Margin Rate/100 - Funding Rate/100))) - Mark Price Order Value)
Entry Order Value is calculated as:
Entry Order Value = Entry Price in cryptocurrency value * # of Contracts
- The Entry Price has to be converted to the contract value in the relevant cryptocurrency. For instructions on how to convert the quoted price of a particular contract to the cryptocurrency value, refer to "How is X Contract Quoted?" under each contract type. (Linear, Inverse, and Quanto)
the formula for Bankruptcy Value is:
Bankruptcy Value = Entry Order Value + 1/Leverage * Entry Order Value
Mark Price Order Value is:
Mark Price Order Value = Round(1/Mark Price, 8)* 100
Example: Buy Order Cost Calculation
Let's say you would like to buy 100,000 XBTUSD contracts at $10,283 with 100x leverage. The required Order Cost is 0.1119 XBT.
Here is how you can calculate that manually:
1. Calculate the Entry Price in the cryptocurrency value
XBT Contract Value = Multiplier / XBTUSD Price
Entry Price in XBT Value = 1/10283
Entry Price in XBT Value = 0.00009725
2. Calculate the Entry Order Value
Entry Order Value = Entry Price in cryptocurrency value * # of Contracts
Entry Order Value = 0.00009725 * 100000
Entry Order Value = 9.725
3. Calculate Bankcruptcy Value
Bankruptcy Value = Entry Order Value + 1/Leverage * Entry Order Value
Bankruptcy Value = 9.725 + 1/100 * 9.725
Bankruptcy Value = 9.82225
4. Calculate Order Cost
Order Cost = 1/Leverage * Entry Order Value + (Entry Order Value + Bankruptcy Value) * Taker Fee
Order Cost = 1/100 * 9.725 + (9.725 + 9.82225) * 0.075%
Order Cost = 0.1119104375
Example: Sell Order Cost Calculation
Let's say you would like to sell 100,000 XBTUSD contracts at $10,283 with 100x leverage.
- Order Cost is 6.2026 XBT
- Liquidation Price is 10348.5
- Mark Price is 27991.65
As the Mark Price is above the potential Liquidation Price, the calculation for this scenario is the following:
Sell Premium = Max(0, Entry Order Value - ABS(Entry Order Value * (1/Leverage - (Maintenance Margin Rate/100 - Funding Rate/100))) - Mark Price Order Value)
1. Calculate the Entry Price in the cryptocurrency value
XBT Contract Value = Multiplier / XBTUSD Price
Entry Price in XBT Value = 1/10283
Entry Price in XBT Value = 0.00009725
2. Calculate the Entry Order Value
Entry Order Value = Entry Price in cryptocurrency value * # of Contracts
Entry Order Value = 0.00009725 * 100000
Entry Order Value = 9.725
3. Calculate Bankcruptcy Value
Bankruptcy Value = Entry Order Value + 1/Leverage * Entry Order Value
Bankruptcy Value = 9.725 + 1/100 * 9.725
Bankruptcy Value = 9.82225
4. Calculate Mark Price Order Value
Mark Price Order Value = Round(1/Mark Price, 8)* # of contracts
Mark Price Order Value = Round(1/27991.65, 8)* 100000
Mark Price Order Value = 0.00003572 * 100000
Mark Price Order Value = 3.572
5. Calculate Sell Premium
Sell Premium = Max(0, Entry Order Value - ABS(Entry Order Value * (1/Leverage - (Maintenance Margin Rate/100 - Funding Rate/100))) - Mark Price Order Value)
Sell Premium = Max(0, 9.725 - ABS(9.725 * (1/100 - (0.35/100 - 0.01/100))) - 3.572)
Sell Premium = 6.08882
6. Calculate Order Cost
Order Cost = 1/Leverage * Entry Order Value + (Entry Order Value + Bankruptcy Value) * Taker Fee + Sell Premium
Order Cost = 1/100 * 9.725 + (9.725 + 9.82225) * 0.075% + 9.65724
Order Cost = 0.1119104375 + 6.08882
Order Cost = 6.20