# List Positions

```typescript
import { SupportedChainId } from "@intentx/core";
import { TradingSDK } from "@intentx/trading-sdk";
import dotenv from "dotenv";

dotenv.config();

async function listPositionsExample() {
  const tradingSDK = new TradingSDK({
    apiKey: process.env.API_KEY,
    baseUrl: process.env.API_BASE_URL ?? undefined,
  });

  const positions = await tradingSDK.tradeManager.getOpenPositionsForSubaccount(
    "0x52D953159a9a636944C9d96E14CB5DF0948323E9",
    SupportedChainId.BASE
  );

  console.log(`You have ${positions.length} open positions`);

  const accountDetails =
    await tradingSDK.accountManager.getSubaccountBalanceDetails(
      "0x52D953159a9a636944C9d96E14CB5DF0948323E9",
      SupportedChainId.BASE
    );

  console.log(
    `You have ${accountDetails.availableForOrder} free balance for orders. Your upnl is $${accountDetails.upnl}`
  );
}

listPositionsExample();
```


---

# 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.intentx.io/trading-api/typescript-sdk/examples/list-positions.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.
