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

# getOpenPositions

> Fetch live Ostium positions, margin summary, and withdrawable collateral.

```ts theme={null}
// Connected wallet (default)
const { pairPositions, marginSummary } =
  await client.getOpenPositions();

// Specific trader (read-only mode)
await client.getOpenPositions({ user: '0xTraderAddress' });

// All traders — no user filter
await client.getOpenPositions({ user: 'ALL' });

// Paginated — first page of 50
await client.getOpenPositions({ user: 'ALL', limit: 50, skip: 0 });

// Paginated — second page
await client.getOpenPositions({ user: 'ALL', limit: 50, skip: 50 });
```

The returned `pairId` and `idx` values are used by position-management methods.

## Parameters

| Parameter     | Type               | Default          | Description                                                                                                              |
| ------------- | ------------------ | ---------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `user`        | `Address \| 'ALL'` | connected wallet | Trader address to scope results to. Pass `'ALL'` to fetch open positions across every trader (no trader filter applied). |
| `blockNumber` | `bigint`           | current block    | Arbitrum block number used for live PnL projection. Auto-fetched when using `OstiumClient`.                              |
| `limit`       | `number`           | `Infinity`       | Maximum number of positions to return.                                                                                   |
| `skip`        | `number`           | `0`              | Number of positions to skip — use with `limit` to paginate.                                                              |

## Response schema

```ts theme={null}
interface Response {
  pairPositions: Array<{
    position: {
      pairTo: string;
      pairFrom: string;
      pairId: string;
      pid: string;
      trader: string;
      idx: number;
      side: 'B' | 'S';
      szi: string;
      entryPx: string;
      leverage: string;
      ntl: string;
      unrealizedPnl: string;
      returnOnEquity: string;
      liquidationPx: string;
      collateralUsed: string;
      cumRollover: string;
      tpPx?: string;
      slPx?: string;
      openTimestamp: number;
      isDayTrade: boolean;
      maxLeverage: string;
      maxWithdrawable: string;
      confirmationStatus?: 'optimistic' | 'initiated' | 'executed' | 'indexed';
      orderId?: string;
      initiatedTx?: string;
      initiatedBlock?: string;
    };
  }>;
  marginSummary: {
    accountValue: string;
    totalCollateralUsed: string;
    totalNtlPos: string;
    totalRawPnlUsd: string;
    totalCumRollover: string;
    totalWithdrawable: string;
  };
  time: number;
}
```
