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

# Reading Markets

> List option pools, resolve Option Identity accounts, and fetch positions, vaults, and loans.

SOS-SDK provides read helpers for loading all active markets, resolving PDAs for a single Option Series, and fetching user positions or OMLP vaults. Every reader takes your `@solana/kit` `rpc` client.

## Listing All Option Pools

Use `fetchAllOptionPools` to load every initialized `OptionPool` on the program:

```ts theme={"dark"}
import { fetchAllOptionPools } from "@epicentral/sos-sdk";
import { rpc } from "./config";

const pools = await fetchAllOptionPools(rpc);

for (const pool of pools) {
  console.log(pool.address, pool.data.totalAvailable, pool.data.totalSoldQty);
}
```

## Resolving an Option Series

When you know an Option Identity, call `resolveOptionAccounts` to derive its PDAs. Pass `rpc` to also fetch the live `OptionAccount`, `OptionPool`, and `CollateralPool` state along with their vault token accounts:

```ts theme={"dark"}
import { OptionType, resolveOptionAccounts } from "@epicentral/sos-sdk";
import { rpc, UNDERLYING_MINT } from "./config";

const resolved = await resolveOptionAccounts({
  underlyingAsset: UNDERLYING_MINT,
  optionType: OptionType.Call,
  strikePrice: 150,
  expirationDate: 1_767_225_600n,
  rpc,
});

console.log({
  optionAccount: resolved.optionAccount,
  optionPool: resolved.optionPool,
  collateralPool: resolved.collateralPool,
  collateralVault: resolved.collateralVault,
  premiumVault: resolved.premiumVault,
  totalAvailable: resolved.optionPoolData?.totalAvailable,
});
```

Without `rpc`, `resolveOptionAccounts` returns only the derived PDAs (`optionAccount`, `longMint`, `shortMint`, `optionPool`, `marketData`, `collateralPool`, `mintAuthority`).

## Reading Positions, Vaults, and Loans

Use the list fetchers to query accounts by wallet or pool, or load single accounts directly by address:

```ts theme={"dark"}
import {
  fetchAllVaults,
  fetchPoolLoansByMaker,
  fetchPositionAccountsByBuyer,
  fetchWriterPositionsByWriter,
  fetchWriterPositionsForPool,
} from "@epicentral/sos-sdk";
import { rpc } from "./config";

const [longs, shorts, loans, vaults] = await Promise.all([
  fetchPositionAccountsByBuyer(rpc, walletAddress),
  fetchWriterPositionsByWriter(rpc, walletAddress),
  fetchPoolLoansByMaker(rpc, walletAddress),
  fetchAllVaults(rpc),
]);

const poolWriters = await fetchWriterPositionsForPool(rpc, optionPoolAddress);
```

### Single-Account Fetchers

When you already have an account address, fetch it directly without a program scan:

| Function | Account Type |
| - | - |
| `fetchOptionPool(rpc, address)` | Single `OptionPool` account |
| `fetchOptionAccount(rpc, address)` | Single `OptionAccount` account |
| `fetchVault(rpc, address)` | Single OMLP `Vault` account |
| `fetchWriterPosition(rpc, address)` | Single `WriterPosition` account |
| `fetchBuyerPosition(rpc, address)` | Single Long `PositionAccount` account |
| `fetchMarketDataAccount(rpc, address)` | Underlying `MarketDataAccount` account |
| `fetchPoolLoan(rpc, address)` | Single OMLP `PoolLoan` account |
| `fetchLenderPosition(rpc, address)` | Single OMLP `LenderPosition` account |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.