# `CCXT.Position`
[🔗](https://github.com/ZenHive/ccxt_client/blob/main/lib/ccxt/position.ex#L1)

Unified derivatives position data.

Represents an open position on a derivatives exchange (futures, swaps, options).

## Fields

  * `id` - Position ID
  * `symbol` - Unified symbol (e.g., "BTC/USDT:USDT")
  * `timestamp` - Last update time in milliseconds
  * `datetime` - ISO 8601 datetime string
  * `side` - "long" or "short"
  * `contracts` - Number of contracts
  * `contract_size` - Size of one contract
  * `notional` - Position notional value
  * `leverage` - Current leverage
  * `unrealized_pnl` - Unrealized profit/loss
  * `realized_pnl` - Realized profit/loss
  * `collateral` - Collateral amount
  * `entry_price` - Average entry price
  * `mark_price` - Current mark price
  * `liquidation_price` - Estimated liquidation price
  * `margin_mode` - "cross" or "isolated"
  * `hedged` - Whether position is in hedge mode
  * `maintenance_margin` - Required maintenance margin
  * `maintenance_margin_percentage` - Maintenance margin as percentage
  * `initial_margin` - Required initial margin
  * `initial_margin_percentage` - Initial margin as percentage
  * `margin_ratio` - Current margin ratio
  * `last_update_timestamp` - Last update timestamp
  * `last_price` - Last traded price
  * `stop_loss_price` - Stop loss price
  * `take_profit_price` - Take profit price
  * `percentage` - Percentage PnL
  * `margin` - Position margin
  * `info` - Raw exchange response

# `t`

```elixir
@type t() :: %CCXT.Position{
  collateral: number() | nil,
  contract_size: number() | nil,
  contracts: number() | nil,
  datetime: String.t() | nil,
  entry_price: number() | nil,
  hedged: boolean() | nil,
  id: String.t() | nil,
  info: map() | nil,
  initial_margin: number() | nil,
  initial_margin_percentage: number() | nil,
  last_price: number() | nil,
  last_update_timestamp: integer() | nil,
  leverage: number() | nil,
  liquidation_price: number() | nil,
  maintenance_margin: number() | nil,
  maintenance_margin_percentage: number() | nil,
  margin: number() | nil,
  margin_mode: String.t() | nil,
  margin_ratio: number() | nil,
  mark_price: number() | nil,
  notional: number() | nil,
  percentage: number() | nil,
  realized_pnl: number() | nil,
  side: String.t() | nil,
  stop_loss_price: number() | nil,
  symbol: String.t() | nil,
  take_profit_price: number() | nil,
  timestamp: integer() | nil,
  unrealized_pnl: number() | nil
}
```

# `long?`

```elixir
@spec long?(t()) :: boolean()
```

Returns true if the position is long.

# `profitable?`

```elixir
@spec profitable?(t()) :: boolean()
```

Returns true if the position has positive unrealized PnL.

# `schema`

```elixir
@spec schema() :: map()
```

JSON Schema for the Position unified type.

# `short?`

```elixir
@spec short?(t()) :: boolean()
```

Returns true if the position is short.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
