> For the complete documentation index, see [llms.txt](https://docs.pearprotocol.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pearprotocol.io/api-integration/trade-activity/open-position.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.pearprotocol.io/api-integration/trade-activity/open-position.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
