> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nilemarkets.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sides

> LONG profits when EUR/USD rises, SHORT profits when it falls — pool takes the opposite side of every trade as sole counterparty in the zero-sum model.

Every forward position on Nile Markets has a **side**: either LONG or SHORT. Your side determines
how your profit and loss responds to EUR/USD price movements. The pool always takes the opposite
side of your trade.

## Two Sides of Every Trade

<Columns cols={2}>
  <Card title="LONG (Side = 0)" icon="arrow-trend-up">
    **Betting that EUR strengthens vs USD**

    You profit when the EUR/USD rate goes up. A move from 1.08 to 1.10 generates profit. A move
    from 1.08 to 1.06 generates a loss.
  </Card>

  <Card title="SHORT (Side = 1)" icon="arrow-trend-down">
    **Betting that EUR weakens vs USD**

    You profit when the EUR/USD rate goes down. A move from 1.08 to 1.06 generates profit. A move
    from 1.08 to 1.10 generates a loss.
  </Card>
</Columns>

The Side enum is defined in `Types.sol` and mirrored in both SDKs:

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={null}
    import { Side } from "@nile-markets/sdk";

    Side.LONG   // 0
    Side.SHORT  // 1
    ```
  </Tab>

  <Tab title="Rust">
    ```rust theme={null}
    use fx_contracts::Side;

    Side::Long   // 0
    Side::Short  // 1
    ```
  </Tab>

  <Tab title="Solidity">
    ```solidity theme={null}
    enum Side {
        LONG,   // 0
        SHORT   // 1
    }
    ```
  </Tab>
</Tabs>

## LONG Position in Detail

A LONG position profits when the EUR/USD exchange rate increases. You are buying EUR and selling USD
at a locked-in forward price. If EUR strengthens by the time the position settles, you profit. If
EUR weakens, you lose.

**PnL Formula:**

```
LONG PnL = notional * (currentPrice - entryStrike) / PRICE_PRECISION
```

<Accordion title="LONG example: EUR strengthens (profit)">
  * **Notional**: 1,000 USDC
  * **Entry strike**: 1.08000 (opened LONG at this forward price)
  * **Settlement price**: 1.10000

  ```
  PnL = 1,000 USDC * (1.10000 - 1.08000) / 1.00000
      = 1,000 * 0.02
      = +20 USDC profit
  ```

  The trader entered expecting EUR to strengthen, and it did. The 200-pip move (1.08 to 1.10)
  translates to +20 USDC on a 1,000 USDC notional.
</Accordion>

<Accordion title="LONG example: EUR weakens (loss)">
  * **Notional**: 1,000 USDC
  * **Entry strike**: 1.08000
  * **Settlement price**: 1.06000

  ```
  PnL = 1,000 USDC * (1.06000 - 1.08000) / 1.00000
      = 1,000 * (-0.02)
      = -20 USDC loss
  ```

  The trader expected EUR to strengthen, but it weakened instead. The loss is deducted from the
  trader's locked margin.
</Accordion>

## SHORT Position in Detail

A SHORT position profits when the EUR/USD exchange rate decreases. You are selling EUR and buying
USD at a locked-in forward price. If EUR weakens by the time the position settles, you profit. If
EUR strengthens, you lose.

**PnL Formula:**

```
SHORT PnL = notional * (entryStrike - currentPrice) / PRICE_PRECISION
```

<Accordion title="SHORT example: EUR weakens (profit)">
  * **Notional**: 1,000 USDC
  * **Entry strike**: 1.08000 (opened SHORT at this forward price)
  * **Settlement price**: 1.06000

  ```
  PnL = 1,000 USDC * (1.08000 - 1.06000) / 1.00000
      = 1,000 * 0.02
      = +20 USDC profit
  ```

  The trader entered expecting EUR to weaken, and it did. The 200-pip move generates +20 USDC.
</Accordion>

<Accordion title="SHORT example: EUR strengthens (loss)">
  * **Notional**: 1,000 USDC
  * **Entry strike**: 1.08000
  * **Settlement price**: 1.10000

  ```
  PnL = 1,000 USDC * (1.08000 - 1.10000) / 1.00000
      = 1,000 * (-0.02)
      = -20 USDC loss
  ```

  The trader expected EUR to weaken, but it strengthened instead. The 20 USDC loss is deducted from
  locked margin.
</Accordion>

## PnL Comparison Table

The following table shows how LONG and SHORT positions respond to the same price movements. All
examples use a 1,000 USDC notional with entry strike of 1.08000.

| EUR/USD Move | Settlement Price | LONG PnL | SHORT PnL |
| ------------ | ---------------- | -------- | --------- |
| +200 pips    | 1.10000          | +20 USDC | -20 USDC  |
| +100 pips    | 1.09000          | +10 USDC | -10 USDC  |
| +50 pips     | 1.08500          | +5 USDC  | -5 USDC   |
| No change    | 1.08000          | 0 USDC   | 0 USDC    |
| -50 pips     | 1.07500          | -5 USDC  | +5 USDC   |
| -100 pips    | 1.07000          | -10 USDC | +10 USDC  |
| -200 pips    | 1.06000          | -20 USDC | +20 USDC  |

<Note>
  PnL is perfectly symmetric between LONG and SHORT. For any given price move, the LONG profit equals
  the SHORT loss, and vice versa. This symmetry is a direct consequence of the zero-sum protocol
  design.
</Note>

## Pool Exposure

The liquidity pool always takes the **opposite side** of every trader position. Understanding this
relationship is important for both traders and liquidity providers.

<AccordionGroup>
  <Accordion title="When a trader opens LONG">
    The pool's net exposure shifts negative (effectively short EUR/USD). If EUR strengthens, the pool
    pays the trader's profit. If EUR weakens, the pool receives the trader's loss.
  </Accordion>

  <Accordion title="When a trader opens SHORT">
    The pool's net exposure shifts positive (effectively long EUR/USD). If EUR weakens, the pool
    pays the trader's profit. If EUR strengthens, the pool receives the trader's loss.
  </Accordion>

  <Accordion title="Net exposure across all positions">
    The pool's total exposure is the net of all open positions. If traders collectively hold more
    LONG notional than SHORT notional, the pool has net short exposure (and vice versa). The
    RiskManager enforces exposure caps to prevent the pool from becoming too directionally exposed.
  </Accordion>
</AccordionGroup>

The pool's net exposure is tracked onchain and can be queried:

```
poolNetExposure = totalShortNotional - totalLongNotional
```

A positive `poolNetExposure` means the pool is net long (more trader shorts than longs). A negative
value means the pool is net short (more trader longs than shorts).

## Choosing a Side

<Tabs>
  <Tab title="Go LONG when...">
    * You expect EUR to strengthen relative to USD
    * Macro indicators favor EUR (hawkish ECB, dovish Fed, improving Eurozone data)
    * You want to hedge existing USD exposure
    * Technical analysis suggests EUR/USD uptrend
  </Tab>

  <Tab title="Go SHORT when...">
    * You expect EUR to weaken relative to USD
    * Macro indicators favor USD (hawkish Fed, dovish ECB, strong US data)
    * You want to hedge existing EUR exposure
    * Technical analysis suggests EUR/USD downtrend
  </Tab>
</Tabs>

<Warning>
  Both sides carry symmetric risk. There is no inherent advantage to being LONG or SHORT -- both
  have the same maximum loss (your locked margin) and the same profit potential. The protocol charges
  the same fees regardless of side.
</Warning>

## Symmetric Risk and Reward

Unlike some DeFi protocols that have asymmetric payoffs (e.g., options, lending liquidations), the
Nile Markets forward contract is fully symmetric:

* **Maximum loss** is identical for both sides: the locked margin on the position
* **Profit potential** is identical for both sides: theoretically unlimited (bounded only by how far
  the price can move before maturity)
* **Trading fees** are the same for both sides
* **Margin requirements** are the same for both sides
* **Liquidation rules** are the same for both sides

This symmetry makes the protocol straightforward to reason about. The only variable that matters for
PnL is the direction and magnitude of the EUR/USD price move relative to your entry strike.
