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

# getPositions

> Fetch open positions with pagination

Returns the user's open positions, paginated.

<Info>
  The examples on this page use **Hyperliquid** (`provider: 'hyperliquid'`). Replace the `provider` value with any supported DEX from `getProviders()`.
</Info>

```typescript theme={null}
import { getPositions } from '@lifi/perps-sdk';

const result = await getPositions(client, {
  provider: 'hyperliquid',
  address: userAddress,
});

for (const pos of result.positions) {
  console.log(pos.market.baseAsset.displaySymbol, pos.side, pos.size, 'PnL:', pos.unrealizedPnl);
}

// Pagination
if (result.pagination.hasMore) {
  const nextPage = await getPositions(client, {
    provider: 'hyperliquid',
    address: userAddress,
    cursor: result.pagination.cursor,
  });
}
```

## Parameters

| Parameter         | Type                | Required | Description                                              |
| ----------------- | ------------------- | -------- | -------------------------------------------------------- |
| `client`          | `PerpsSDKClient`    | Yes      | SDK client                                               |
| `params.provider` | `string`            | Yes      | DEX identifier                                           |
| `params.address`  | `string`            | Yes      | User's wallet address                                    |
| `params.marketId` | `string`            | No       | Filter by the canonical `Market.id` (not display symbol) |
| `params.limit`    | `number`            | No       | Items per page (default 50, max 100)                     |
| `params.cursor`   | `string`            | No       | Pagination cursor from previous response                 |
| `options`         | `SDKRequestOptions` | No       | Request options                                          |

## Returns

`PositionsResponse`:

| Field        | Type         | Description         |
| ------------ | ------------ | ------------------- |
| `provider`   | `string`     | Provider identifier |
| `positions`  | `Position[]` | Open positions      |
| `pagination` | `Pagination` | Pagination metadata |

## Position fields

| Field              | Type                    | Description                                                                                                                        |
| ------------------ | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `market`           | `MarketDisplay`         | Market identity (`providerId`, `id`, `categoryId`, `baseAsset`, `quoteAsset`). Display symbol is `market.baseAsset.displaySymbol`. |
| `side`             | `'LONG' \| 'SHORT'`     | Position direction                                                                                                                 |
| `size`             | `string`                | Position size                                                                                                                      |
| `entryPrice`       | `string`                | Average entry price                                                                                                                |
| `markPrice`        | `string`                | Current mark price                                                                                                                 |
| `liquidationPrice` | `string`                | Estimated liquidation price                                                                                                        |
| `unrealizedPnl`    | `string`                | Unrealized profit/loss                                                                                                             |
| `leverage`         | `number`                | Current leverage                                                                                                                   |
| `marginUsed`       | `string`                | Margin allocated                                                                                                                   |
| `marginMode`       | `'ISOLATED' \| 'CROSS'` | Margin mode                                                                                                                        |

**API Reference:** [GET /positions](/api-reference/account#getpositions)
