# Open Position

Open positions are Pear's synthetic basket positions that currently have non-zero asset sizes. Each position represents a basket trade with independent PnL, entry prices, and risk parameters.

Positions with `FULLY_EXTERNAL` execution flag are excluded.

#### Access

* **REST**: `GET /positions`
* **WebSocket**: `open-positions` channel (requires address)

#### What's Computed

Raw position data (entry prices, sizes, weights) is enriched with live Hyperliquid mark prices.

**Per Asset**

| Field           | Description                                                        |
| --------------- | ------------------------------------------------------------------ |
| `unrealizedPnl` | `(markPrice - entryPrice) × size` for longs, inverse for shorts    |
| `marginUsed`    | `markPrice × size / leverage`                                      |
| `targetWeight`  | From original order (normalized), or entry value share as fallback |
| `fundingPaid`   | Cumulative funding paid/received                                   |

**Per Position**

| Field                                | Description                                                      |
| ------------------------------------ | ---------------------------------------------------------------- |
| `entryRatio` / `markRatio`           | Geometric weighted ratio using target weights (see below)        |
| `entryPriceRatio` / `markPriceRatio` | Simple `longPrice / shortPrice`, only for 1-long / 1-short pairs |
| `unrealizedPnl`                      | Sum across all assets                                            |
| `unrealizedPnlPercentage`            | PnL relative to total margin used                                |
| `positionValue`                      | `entryPositionValue + unrealizedPnl`                             |
| `takeProfit` / `stopLoss`            | Active risk parameters if set                                    |

**Weighted Ratio Calculation**

`entryRatio` and `markRatio` use a geometric weighted product with each asset's **target weight** as the exponent:

```
entryRatio = ∏(longEntryPrice ^ targetWeight) × ∏(shortEntryPrice ^ -targetWeight)
markRatio  = ∏(longMarkPrice  ^ targetWeight) × ∏(shortMarkPrice  ^ -targetWeight)
```

Target weight comes from original order weights (normalized). If not set, falls back to asset's share of total entry value. This means the ratio reflects the basket's intended allocation, not actual filled proportions which may drift due to price movement or partial fills.


---

# 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.pearprotocol.io/api-integration/trade-activity/open-position.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.
