# Futures Trading

## Step 1: Opening a Position

**Action**: The user opens a perpetual futures position by providing collateral in USDT and selecting leverage. The platform calculates required margin and maximum position size.

**Formula**:

* $$Maximum Position Size = Collateral × Leverage$$
* $$Required Margin = Position SizeLeverage$$
* $$Initial Margin Ratio = 1Leverage$$

**Example**:

* Collateral: `1000 USDT`
* Selected leverage: `5x`
* Maximum position size: `1000 × 5 = 5000 USDT`
* Required margin: `5000 ÷ 5 = 1000 USDT`
* Initial margin ratio: `1 ÷ 5 = 20%`

**Outcome**: Position is opened with specified parameters, and the required margin is locked as collateral.

## Step 2: Position Management

**Action**: The user manages their position by monitoring and adjusting risk parameters. The platform continuously calculates position PnL and margin ratios.

**Formula**:

* $$Unrealized PnL = (Current Price - Entry Price) × Position Size × Side$$
  * Side = -1 for shorts, 1 for longs,
* $$Margin Ratio = (Collateral + Unrealized PnL)Position Size$$
* $$Liquidation Price = Entry Price × (1 ± Maintenance Margin Ratio × Leverage)$$
  * \+ for shorts, - for longs

**Example**:

* Entry price: `2000 USDT`
* Position size: `5000 USDT (2.5 units)`
* Current price: `2100 USDT`
* Long position PnL: `(2100 - 2000) × 2,5 = 250 USDT`
* New margin ratio: `(1000 + 250) ÷ 5000 = 25%`

**Outcome**: Position status updated in real-time with current PnL and risk metrics.

## Step 3: Fee Calculation

**Action**: The platform calculates and charges trading fees based on position size and holder status.

**Formula**:

* $$Standard Fee = Position Size × Base Fee Rate$$
* $$Discounted Fee = Position Size × Base Fee Rate × (1 - Discount Rate)$$

**Example**:

* Position size: `5000 USD`
* Base fee rate: `0,1%`
* Standard fee: `5000 × 0,001 = 5 USDT`
* Additional discounts: `20%`
* Discounted fee: `5 × (1 - 0,2) = 4 USDT`

**Outcome**: Fees are automatically deducted from the user's account.

## Step 4: Position Closure

**Action**: The user closes their position either manually or through automated triggers (take-profit/stop-loss).

**Formula**:

* $$Realized PnL = (Exit Price - Entry Price) × Position Size × Side - Total Fees$$
* $$ROE (Return on Equity) = Realized PnLInitial Margin × 100%$$

**Example**:

* Entry price: `2000 USDT`
* Exit price: `2100 USDT`
* Position size: `5000 USDT`
* Total fees: `8 USDT (entry + exit)`
* Realized PnL: `(2100 - 2000) × 2,5 - 8 = 242 USDT`
* ROE: `242 ÷ 1000 × 100% = 24,2%`

**Outcome**: Position is closed, PnL is realized, and funds are returned to the user's available balance.

## Step 5: Position Liquidation

**Action**: The platform automatically liquidates a user's position if the margin ratio falls below the maintenance margin requirement to prevent insolvency.

**Formula**:

* Liquidation Price (for longs):$$\text{Liquidation Price} = \text{Entry Price} \times \left(1 - \frac{\text{Initial Margin Ratio} - \text{Maintenance Margin Ratio}}{\text{Leverage}}\right)$$
* Liquidation Price (for shorts):\
  $$\text{Liquidation Price} = \text{Entry Price} \times \left(1 + \frac{\text{Initial Margin Ratio} - \text{Maintenance Margin Ratio}}{\text{Leverage}}\right)$$

**Example**:

* Entry Price: `2000 USDT`
* **Position Size**: `5000 USDT (2.5 units)`
* **Leverage**: `5x`
* **Maintenance Margin Ratio**: `2%`
* Liquidation price for a **long** position:\
  $$2000 \times \left(1 - \frac{0.20 - 0.02}{5}\right) = 2000 \times 0.96 = 1920 , \text{USDT}$$
* Liquidation price for a **short** position:\
  $$2000 \times \left(1 + \frac{0.20 - 0.02}{5}\right) = 2000 \times 1.04 = 2080 , \text{USDT}$$

**Outcome**: If the market price reaches the liquidation price, the platform closes the position at the current market price.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.evedex.com/guides/futures-trading.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
