**Order Cost** refers to the total margin required to open a position. Depending on the direction of your position, either long or short, different formulas are used to calculate the order cost for limit and market orders.

### Long Position

**Formula for Calculating Order Cost:**

Order Cost = Initial Margin + Buy Fee + Sell Fee

- Initial Margin = (Order Price × Order Quantity) / Leverage
- Buy Fee = Order Quantity × Order Price × Taker Fee Rate
- Sell Fee = Order Quantity × Liquidation Price × Taker Fee Rate
- Long Position Liquidation Price = Order Price × (Leverage − 1) / Leverage

#### Example:

Trader A opens a long position of 1 BTC with 10x leverage at a price of 50,000 USDT.

The order cost is calculated as follows:

- Initial Margin = (50,000 × 1) / 10 = 5,000 USDT
- Buy Fee = 1 × 50,000 × 0.055% = 27.5 USDT
- Sell Fee = 1 × 50,000 × (10 − 1) / 10 × 0.055% = 24.75 USDT

Therefore, the Order Cost = 5,000 + 27.5 + 24.75 = 5,052.25 USDT.

To determine the position size based on the order cost, the following formula can be used:

For Trader A:

- Position Size = Order Cost × Leverage / [Order Price × (0.0011 × Leverage + 0.99945)]

Calculating this:

- Position Size = 5,052.25 × 10 / [50,000 × (0.0011 × 10 + 0.99945)]
- Position Size = 1 BTC

### Short Position

**Formula for Calculating Order Cost:**

Order Cost = Initial Margin + Buy Fee + Sell Fee

- Initial Margin = (Order Price × Order Quantity) / Leverage
- Buy Fee = Order Quantity × Order Price × Taker Fee Rate
- Sell Fee = Order Quantity × Liquidation Price × Taker Fee Rate
- Short Position Liquidation Price = Order Price × (Leverage + 1) / Leverage

#### Example:

Trader B opens a short position of 1 BTC with 10x leverage at a price of 55,000 USDT.

The order cost is calculated as follows:

- Initial Margin = (55,000 × 1) / 10 = 5,500 USDT
- Buy Fee = 1 × 55,000 × 0.055% = 30.25 USDT
- Sell Fee = 1 × 55,000 × (10 + 1) / 10 × 0.055% = 33.275 USDT

Therefore, the Order Cost = 5,500 + 30.25 + 33.275 = 5,563.525 USDT.

To determine the position size based on the order cost, the following formula can be used:

For Trader B:

- Position Size = Order Cost × Leverage / [Order Price × (0.0011 × Leverage + 1.00055)]

Calculating this:

- Position Size = 5,563.525 × 10 / [55,000 × (0.0011 × 10 + 1.00055)]
- Position Size = 1 BTC