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

# Open Positions

> Subscribe to open positions for your account

<div className="api-banner">
  <span className="api-protocol ws">WSS</span>
  <span className="api-detail">futures.kraken.com/ws/v1</span>
  <span className="api-tag">open\_positions</span>
</div>

This subscription feed publishes the open positions of the user account.

***

## Request

<ResponseField name="event" type="string" required>
  `subscribe` or `unsubscribe`
</ResponseField>

<ResponseField name="feed" type="string" required>
  The requested subscription feed. Value: `open_positions`
</ResponseField>

<ResponseField name="api_key" type="string" required>
  The user API key.
</ResponseField>

<ResponseField name="original_challenge" type="string" required>
  The message that is received from a challenge request.
</ResponseField>

<ResponseField name="signed_challenge" type="string" required>
  The signed challenge message with user API secret.
</ResponseField>

<CodeGroup>
  ```json Example theme={null}
  {
    "event": "subscribe",
    "feed": "open_positions",
    "api_key": "CMl2SeSn09Tz+2tWuzPiPUjaXEQRGq6qv5UaexXuQ3SnahDQU/gO3aT+",
    "original_challenge": "226aee50-88fc-4618-a42a-34f7709570b2",
    "signed_challenge": "RE0DVOc7vS6pzcEjGWd/WJRRBWb54RkyvV+AZQSRl4+rap8Rlk64diR+Z9DQILm7qxncswMmJyvP/2vgzqqh+g=="
  }
  ```
</CodeGroup>

***

## Response Success

<ResponseField name="event" type="string">
  <span className="field-attr">One of:</span> `subscribed`, `subscribed_failed`, `unsubscribed`, `unsubscribed_failed`

  The result.
</ResponseField>

<ResponseField name="feed" type="string">
  The requested subscription feed. Value: `open_positions`
</ResponseField>

<ResponseField name="api_key" type="string">
  The user API key.
</ResponseField>

<ResponseField name="original_challenge" type="string">
  The message that is received from a challenge request.
</ResponseField>

<ResponseField name="signed_challenge" type="string">
  The signed challenge message with user API secret.
</ResponseField>

<CodeGroup>
  ```json Example theme={null}
  {
    "event": "subscribed",
    "feed": "open_positions",
    "api_key": "CMl2SeSn09Tz+2tWuzPiPUjaXEQRGq6qv5UaexXuQ3SnahDQU/gO3aT+",
    "original_challenge": "226aee50-88fc-4618-a42a-34f7709570b2",
    "signed_challenge": "RE0DVOc7vS6pzcEjGWd/WJRRBWb54RkyvV+AZQSRl4+rap8Rlk64diR+Z9DQILm7qxncswMmJyvP/2vgzqqh+g=="
  }
  ```
</CodeGroup>

***

## Response Snapshot

<ResponseField name="feed" type="string">
  The subscribed feed.
</ResponseField>

<ResponseField name="account" type="string">
  The user account.
</ResponseField>

<ResponseField name="seq" type="positive integer">
  The subscription message sequence number.
</ResponseField>

<ResponseField name="timestamp" type="positive integer">
  The UTC time in milliseconds.
</ResponseField>

<ResponseField name="positions" type="list of structures">
  A list containing the user open positions.

  <Expandable title="properties">
    <ResponseField name="instrument" type="string">The instrument (referred also as symbol or product\_id) of the order.</ResponseField>
    <ResponseField name="balance" type="float">The size of the position.</ResponseField>
    <ResponseField name="entry_price" type="positive float">The average entry price of the instrument.</ResponseField>
    <ResponseField name="mark_price" type="positive float">The market price of the position instrument.</ResponseField>
    <ResponseField name="index_price" type="positive float">The index price of the position instrument.</ResponseField>
    <ResponseField name="pnl" type="float">The profit and loss of the position.</ResponseField>
    <ResponseField name="liquidation_threshold" type="float">The mark price of the contract at which the position will be liquidated.</ResponseField>
    <ResponseField name="return_on_equity" type="float">The percentage gain or loss relative to the initial margin used in the position. Formula: PnL/IM.</ResponseField>
    <ResponseField name="unrealized_funding" type="float">Unrealised funding from funding rate.</ResponseField>
    <ResponseField name="effective_leverage" type="float">How leveraged the net position is in a given margin account. Formula: Position Value at Market / Portfolio Value.</ResponseField>
    <ResponseField name="initial_margin" type="float">The initial margin for the open position.</ResponseField>
    <ResponseField name="initial_margin_with_orders" type="float">The initial margin for the open position and open orders of the same instrument.</ResponseField>
    <ResponseField name="maintenance_margin" type="float">The maintenance margin for the open position.</ResponseField>
    <ResponseField name="pnl_currency" type="string">The profit currency for the position, not returned for inverse positions.</ResponseField>
    <ResponseField name="max_fixed_leverage" type="positive float">The maximum allowed fixed leverage for the position's instrument.</ResponseField>
    <ResponseField name="fill_time" type="ISO8601 datetime">The time the most recent fill occurred for this position.</ResponseField>
    <ResponseField name="iv" type="float">The option's implied volatility.</ResponseField>
    <ResponseField name="delta" type="float">Delta, the option value's sensitivity to change in the underlying price.</ResponseField>
    <ResponseField name="theta" type="float">Theta, the option value's sensitivity to the passage of time.</ResponseField>
    <ResponseField name="gamma" type="float">Gamma, delta's sensitivity to change in the underlying price.</ResponseField>
    <ResponseField name="vega" type="float">Vega, the option value's sensitivity to change in volatility.</ResponseField>
    <ResponseField name="rho" type="float">Rho, the option value's sensitivity to the interest rate.</ResponseField>
  </Expandable>
</ResponseField>

<CodeGroup>
  ```json Example theme={null}
  {
    "feed": "open_positions",
    "account": "DemoUser",
    "positions": [
      {
        "instrument": "PF_XRPUSD",
        "balance": 500.0,
        "pnl": -239.6506683474764,
        "entry_price": 0.3985,
        "mark_price": 0.4925844,
        "index_price": 0.49756,
        "liquidation_threshold": 0.0,
        "effective_leverage": 0.17404676894304316,
        "return_on_equity": -2.3609636135508127,
        "initial_margin": 101.5054475943615,
        "initial_margin_with_orders": 101.5054475943615,
        "maintenance_margin": 50.75272379718075
      },
      {
        "instrument": "PF_XBTUSD",
        "balance": 0.04,
        "pnl": 119.56244985549435,
        "entry_price": 26911.75,
        "mark_price": 29900.81124638736,
        "index_price": 29900.47,
        "liquidation_threshold": 9572.804662403718,
        "effective_leverage": 0.31865408963748215,
        "return_on_equity": 5.553450159107747,
        "unrealized_funding": 0.0004114160669590132,
        "initial_margin": 21.529400000000003,
        "initial_margin_with_orders": 21.529400000000003,
        "maintenance_margin": 10.764700000000001,
        "pnl_currency": "USD"
      },
      {
        "instrument": "OF_ETHUSD_240101_1000_C",
        "balance": 0.04,
        "pnl": 119.56244985549435,
        "entry_price": 26911.75,
        "mark_price": 29900.81124638736,
        "index_price": 29900.47,
        "return_on_equity": 5.553450159107747,
        "iv": 0.3,
        "delta": 0.5,
        "gamma": 0.5,
        "vega": 0.5,
        "theta": 0.5,
        "rho": 0.5
      }
    ],
    "seq": 4,
    "timestamp": 1687383625330
  }
  ```
</CodeGroup>

***

## Response Error

<ResponseField name="event" type="string">
  Value: `error`
</ResponseField>

<ResponseField name="message" type="string">
  <span className="field-attr">One of:</span> `Invalid product id`, `Invalid feed`, `Json Error`

  An error message.
</ResponseField>

<CodeGroup>
  ```json Example theme={null}
  {
    "event": "error",
    "message": "Invalid product id"
  }
  ```
</CodeGroup>
