# getPositionInfoList

The `getPositionInfoList` function retrieves detailed information about positions based on a list of position cap information.

#### Function Signature

```typescript
getPositionInfoList(
  positionCapInfoList: IPositionCapInfo[],
  owner: string
): Promise<IPositionInfo[]>
```

#### Parameters

* `positionCapInfoList`: An array of `IPositionCapInfo` objects, typically obtained from `getPositionCapInfoList`.
* `owner`: A string representing the owner's address.

#### Return Value

Returns a `Promise` that resolves to an array of `IPositionInfo` objects. Each `IPositionInfo` object contains detailed information about a position, including:

```typescript
interface IPositionInfo {
  id: string;
  long: boolean;
  owner: string;
  version: number;
  collateralToken: string;
  indexToken: string;
  collateralAmount: number;
  positionAmount: number;
  reservedAmount: number;
  positionSize: number;
  lastFundingRate: number;
  lastReservingRate: number;
  reservingFeeAmount: number;
  fundingFeeValue: number;
  closed: boolean;
  openTimestamp: number;
  protocol?: string;
}
```

#### Description

This function takes a list of position cap information and fetches detailed data for each position. It calculates additional information such as reserving fee amount and funding fee value for open positions.

#### Usage Example

```typescript
const owner = "0x1234..."; // Replace with actual owner address
const sudoAPI = new SudoAPI(provider);

try {
  const positionCaps = await sudoAPI.getPositionCapInfoList(owner);
  const positionInfoList = await sudoAPI.getPositionInfoList(positionCaps, owner);
  console.log("Position Info List:", positionInfoList);
} catch (error) {
  console.error("Error fetching position information:", error);
}
```

#### Notes

* The function sorts the returned positions by `openTimestamp` in ascending order.
* For open positions, the function calculates `reservingFeeAmount` and `fundingFeeValue` using separate API calls.
* If there's an error calculating `reservingFeeAmount` or `fundingFeeValue`, these values are set to 0 and the error is logged.


---

# 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.sudo.finance/sudo-sdk/v0.0.6/api-reference/sudoapi/getpositioninfolist.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.
