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

# Read data

> Read Tayho markets, accounts, positions, vault, staking, orders, and transactions with explicit consistency semantics.

# Read data

SDK reads return an `ApiResponse<T>`:

```ts theme={null}
interface ApiResponse<T> {
  data: T;
  cursor?: string | null;
  checkpoint?: bigint | null;
  requestId: string;
}
```

`requestId` is the correlation value to include in support reports. `checkpoint` identifies the
indexed state when supplied. A cursor is opaque and must be returned unchanged.

## Markets

| Method                                 | Result                               |
| -------------------------------------- | ------------------------------------ |
| `markets.list({ limit })`              | Current markets                      |
| `markets.get(marketId)`                | One market and its funding state     |
| `markets.funding(marketId, { limit })` | Recent funding updates               |
| `markets.stats(marketId)`              | Aggregate market statistics          |
| `markets.price(marketId)`              | Indexed price snapshot               |
| `markets.oracle(marketId)`             | Oracle state                         |
| `markets.liquidity(marketId)`          | Vault and open-interest state        |
| `markets.events(marketId, page)`       | Canonical market lifecycle events    |
| `markets.trades(marketId, page)`       | Executions and settlements           |
| `markets.candles(marketId, query)`     | TWAP candles for supported intervals |

```ts theme={null}
const candles = await client.markets.candles(1n, {
  interval: 900,
  from: 1_800_000_000n,
  limit: 100,
});
```

Supported candle intervals are 60, 300, 900, 3,600, 14,400, and 86,400 seconds.

## Accounts and portfolio

| Method                                 | Result                            |
| -------------------------------------- | --------------------------------- |
| `accounts.positions(address, query)`   | Open or closed positions          |
| `accounts.sessions(address, query)`    | Session history/state             |
| `accounts.portfolio(address)`          | Portfolio summary                 |
| `accounts.balances(address)`           | Indexed token balances            |
| `accounts.exposure(address)`           | Open exposure by market/direction |
| `accounts.pnl(address)`                | Realized PnL and funding totals   |
| `accounts.activity(address, query)`    | Unified account activity          |
| `accounts.trades(address, query)`      | Executions                        |
| `accounts.funding(address, query)`     | Funding settlements               |
| `accounts.settlements(address, query)` | Position settlements              |
| `accounts.transfers(address, query)`   | Token transfers                   |

```ts theme={null}
const positions = await client.accounts.positions(account, {
  status: "OPEN",
  limit: 50,
});
```

Addresses must be 20-byte EVM addresses. The SDK rejects malformed input before making a request.

## Positions

```ts theme={null}
await client.positions.get(42n);
await client.positions.events(42n, { limit: 50 });
await client.positions.settlements(42n, { limit: 50 });
await client.positions.risk(42n);
```

`positions.risk` is a live execution-oriented read. Indexed position history and live risk may be
observed at different blocks; use the response source/checkpoint and action preparation snapshot
rather than merging them as if atomic.

## Vault and staking

```ts theme={null}
await client.vault.get();
await client.vault.events({ limit: 50 });
await client.vault.claims({ status: "PENDING", limit: 50 });
await client.vault.account(account, { limit: 50 });

await client.staking.get();
await client.staking.events({ limit: 50 });
await client.staking.account(account, { limit: 50 });
```

Vault account history includes deposits, withdrawals, and claims. Staking account history includes
stake changes and rewards.

## Orders and transactions

```ts theme={null}
await client.orders.get(orderHash);
await client.orders.list(account, { status: "EXECUTED", limit: 50 });
await client.transactions.get(transactionHash);
```

Order status is canonical onchain outcome data. Offchain automatic-intent and relayed-action
lifecycle is accessed through the preparation/submission receipt APIs described in
[Relayed actions](/public/sdk/actions) and [Orders](/public/sdk/orders).

## Direct snapshot reads

Action preparation constructs typed contract calls and runs them with `ChainReader.readAtBlock`.
The native and provider adapters encode a Multicall3 `aggregate3` request, pin it to one block, and
decode named ABI results.

The public API can supply this bounded action snapshot when no direct reader is configured. Native
balance and transaction-receipt reads require a direct reader.

## Pagination

```ts theme={null}
let cursor: string | undefined;
do {
  const page = await client.markets.events(1n, { limit: 100, cursor });
  consume(page.data);
  cursor = page.cursor ?? undefined;
} while (cursor);
```

Do not manufacture, decode, reorder, or share cursors across endpoints. A page may expose `null`
when no further page exists.
