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

# Assets

> Fetch tradeable assets, prices, OHLCV candles, and orderbooks

Fetch asset details, prices, OHLCV chart data, and orderbook snapshots.

<Info>
  The examples on this page use **Hyperliquid** (`provider: 'hyperliquid'`). Replace the `provider` value with any supported DEX from [`getProviders()`](/sdk/providers).
</Info>

## getAssets

Returns the token/asset registry for a specified DEX — the base entities referenced by markets (as base/quote legs) and by account balances. Static market metadata (leverage, margin) lives on `Market` via [`getMarkets`](#getmarkets); live data (mark price, funding) lives on `MarketContext` via [`getMarketsContext`](#getmarketscontext).

```typescript theme={null}
import { getAssets } from '@lifi/perps-sdk';

const { assets } = await getAssets(client, { provider: 'hyperliquid' });

for (const asset of assets) {
  console.log(asset.id, asset.displaySymbol);
}
// BTC BTC
// ETH ETH
```

### Parameters

| Parameter         | Type                | Required | Description         |
| ----------------- | ------------------- | -------- | ------------------- |
| `client`          | `PerpsSDKClient`    | Yes      | SDK client          |
| `params.provider` | `string`            | Yes      | Provider identifier |
| `options`         | `SDKRequestOptions` | No       | Request options     |

### Returns

`AssetsResponse` — `{ assets: Asset[] }`:

Each `Asset`:

| Field                 | Type        | Description                                                                                                                                                       |
| --------------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `providerId`          | `string`    | Provider that minted this asset                                                                                                                                   |
| `id`                  | `string`    | Provider's own asset id. Lighter: numeric `asset_id` stringified. Hyperliquid spot: the venue token index, never the coin symbol (that lives in `displaySymbol`). |
| `displaySymbol`       | `string`    | UI-friendly base symbol (e.g., `"BTC"`, `"PURR"`)                                                                                                                 |
| `logoURI`             | `string`    | URL to asset logo                                                                                                                                                 |
| `displayName`         | `string?`   | Full asset name (e.g., `"Bitcoin"`)                                                                                                                               |
| `tags`                | `string[]?` | Curated lowercase-kebab slugs used for search and grouping                                                                                                        |
| `aliases`             | `string[]?` | Display symbols used by other venues for the same real-world asset                                                                                                |
| `decimals`            | `number?`   | Venue wire precision for this asset                                                                                                                               |
| `l1Decimals`          | `number?`   | L1 token-contract precision, which can differ from venue precision                                                                                                |
| `l1Address`           | `string?`   | L1 token address; the zero address denotes native gas                                                                                                             |
| `minWithdrawalAmount` | `string?`   | Venue minimum for one withdrawal, denominated in this asset rather than USD                                                                                       |

**API Reference:** [GET /assets](/api-reference/market-data#get-assets)

***

## getMarkets

Returns all tradeable markets for a specified DEX as static instrument metadata — ids, base/quote assets, decimals, leverage, and margin. Live data (mark price, funding, open interest, volume) comes from [`getMarketsContext`](#getmarketscontext).

```typescript theme={null}
import { getMarkets } from '@lifi/perps-sdk';

const { markets } = await getMarkets(client, { provider: 'hyperliquid' });

for (const market of markets) {
  console.log(market.baseAsset.displaySymbol, market.maxLeverage);
}
// BTC 50
// ETH 50
```

### Parameters

| Parameter          | Type                | Required | Description                                                                   |
| ------------------ | ------------------- | -------- | ----------------------------------------------------------------------------- |
| `client`           | `PerpsSDKClient`    | Yes      | SDK client                                                                    |
| `params.provider`  | `string`            | Yes      | Provider identifier                                                           |
| `params.marketIds` | `string[]`          | No       | Filter to specific markets by the canonical `Market.id` (not display symbols) |
| `options`          | `SDKRequestOptions` | No       | Request options                                                               |

### Returns

`MarketsResponse` — `{ markets: Market[] }`. A `Market` is either a `PerpsMarket` or a `SpotMarket`; both extend `BaseMarket`:

| Field            | Type       | Description                                                                                                                     |
| ---------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `providerId`     | `string`   | Provider that owns this market                                                                                                  |
| `id`             | `string`   | Provider's canonical, stringified market id that uniquely identifies the trading instrument; referenced elsewhere as `marketId` |
| `categoryId`     | `string`   | References a `ProviderCategory` by id                                                                                           |
| `baseAsset`      | `Asset`    | Base leg                                                                                                                        |
| `quoteAsset`     | `Asset`    | Quote leg                                                                                                                       |
| `szDecimals`     | `number`   | Size decimal places                                                                                                             |
| `priceDecimals`  | `number?`  | Price decimal places, when the provider publishes them                                                                          |
| `isDelisted`     | `boolean?` | Whether the venue has delisted the market. Treat only `true` as delisted.                                                       |
| `priceIncrement` | `string?`  | Exact price tick as a decimal string when `priceDecimals` alone cannot describe the venue grid                                  |
| `sizeIncrement`  | `string?`  | Exact size lot as a decimal string when `szDecimals` alone cannot describe the venue grid                                       |

`PerpsMarket` adds:

| Field                      | Type                       | Description                                                                                        |
| -------------------------- | -------------------------- | -------------------------------------------------------------------------------------------------- |
| `maxLeverage`              | `number`                   | Maximum allowed leverage                                                                           |
| `onlyIsolated`             | `boolean`                  | Whether only isolated margin is supported                                                          |
| `maintenanceMarginRate`    | `number?`                  | Maintenance margin requirement as a fraction (e.g. `0.012` = 1.2%), when the provider publishes it |
| `positionMarginAdjustment` | `PositionMarginAdjustment` | Per-market capability: `NONE`, `ADD_ONLY`, or `ADD_AND_REMOVE`                                     |

Live per-market data (mark price, previous-day price, 24h volume, open interest, funding) comes from [`getMarketsContext`](#getmarketscontext).

**API Reference:** [GET /markets](/api-reference/market-data#get-markets)

***

## getMarket

Returns a single market by its canonical `marketId`.

```typescript theme={null}
import { getMarket } from '@lifi/perps-sdk';

const btc = await getMarket(client, { provider: 'hyperliquid', marketId: 'BTC' });
console.log(btc.baseAsset.displaySymbol, btc.maxLeverage);
// BTC 50
```

### Parameters

| Parameter         | Type                | Required | Description                                        |
| ----------------- | ------------------- | -------- | -------------------------------------------------- |
| `client`          | `PerpsSDKClient`    | Yes      | SDK client                                         |
| `params.provider` | `string`            | Yes      | Provider identifier                                |
| `params.marketId` | `string`            | Yes      | The canonical `Market.id` (not the display symbol) |
| `options`         | `SDKRequestOptions` | No       | Request options                                    |

### Returns

`Market` — single market object (same shape as above).

**API Reference:** [GET /markets](/api-reference/market-data#get-markets)

***

## getMarketsContext

Returns live per-market context for all markets: `midPrice`, `markPrice`, and (where the venue publishes it) `oraclePrice`; `prevDayPrice`, `priceChange24h`, and `volume24h` for every market; `marketCap` where the venue publishes circulating supply; and `openInterest` and `funding` for perps. Intended for frequent polling; pair it with the static metadata from [`getMarkets`](#getmarkets).

```typescript theme={null}
import { getMarketsContext } from '@lifi/perps-sdk';

const { prices } = await getMarketsContext(client, { provider: 'hyperliquid' });
for (const p of prices) {
  console.log(p.marketId, p.midPrice, p.markPrice);
}
// 0 95000.50 95000.50
// 1 3200.25 3200.25
```

### Parameters

| Parameter          | Type                | Required | Description                                                                   |
| ------------------ | ------------------- | -------- | ----------------------------------------------------------------------------- |
| `client`           | `PerpsSDKClient`    | Yes      | SDK client                                                                    |
| `params.provider`  | `string`            | Yes      | Provider identifier                                                           |
| `params.marketIds` | `string[]`          | No       | Filter to specific markets by the canonical `Market.id` (not display symbols) |
| `options`          | `SDKRequestOptions` | No       | Request options                                                               |

### Returns

`PricesResponse` — `{ prices: MarketContext[] }`:

Each `MarketContext`:

| Field            | Type           | Description                                                         |
| ---------------- | -------------- | ------------------------------------------------------------------- |
| `marketId`       | `string`       | The canonical `Market.id`                                           |
| `midPrice`       | `string`       | Current mid price                                                   |
| `markPrice`      | `string`       | Current mark price                                                  |
| `oraclePrice`    | `string?`      | Venue oracle/index price, where the venue publishes one             |
| `prevDayPrice`   | `string?`      | Previous day's price                                                |
| `priceChange24h` | `string?`      | 24-hour price change                                                |
| `volume24h`      | `string?`      | 24-hour trading volume in USD                                       |
| `marketCap`      | `string?`      | Market capitalization, where the venue publishes circulating supply |
| `openInterest`   | `string?`      | Total open interest in USD (perps markets only)                     |
| `funding`        | `FundingInfo?` | Current funding rate and next funding time (perps markets only)     |

**API Reference:** [GET /marketsContext](/api-reference/market-data#get-marketscontext)

***

## getOhlcv

Returns OHLCV candle data for charts.

```typescript theme={null}
import { getOhlcv } from '@lifi/perps-sdk';

const { candles } = await getOhlcv(client, {
  provider: 'hyperliquid',
  marketId: 'BTC',
  interval: '1h',
  limit: 100,
});

for (const candle of candles) {
  console.log(candle.t, candle.o, candle.h, candle.l, candle.c, candle.v);
}
```

### Parameters

| Parameter          | Type                | Required | Description                                                                                            |
| ------------------ | ------------------- | -------- | ------------------------------------------------------------------------------------------------------ |
| `client`           | `PerpsSDKClient`    | Yes      | SDK client                                                                                             |
| `params.provider`  | `string`            | Yes      | Provider identifier                                                                                    |
| `params.marketId`  | `string`            | Yes      | The canonical `Market.id`                                                                              |
| `params.interval`  | `string`            | Yes      | Candle interval: `1m`, `3m`, `5m`, `15m`, `30m`, `1h`, `2h`, `4h`, `8h`, `12h`, `1d`, `3d`, `1w`, `1M` |
| `params.startTime` | `number`            | No       | Start timestamp in milliseconds                                                                        |
| `params.endTime`   | `number`            | No       | End timestamp in milliseconds                                                                          |
| `params.limit`     | `number`            | No       | Max candles to return (default 100, max 1000)                                                          |
| `options`          | `SDKRequestOptions` | No       | Request options                                                                                        |

### Returns

`OhlcvResponse`:

| Field      | Type       | Description               |
| ---------- | ---------- | ------------------------- |
| `provider` | `string`   | Provider identifier       |
| `marketId` | `string`   | The canonical `Market.id` |
| `interval` | `string`   | Candle interval           |
| `candles`  | `Candle[]` | Array of candle data      |

Each `Candle`:

| Field | Type     | Description               |
| ----- | -------- | ------------------------- |
| `t`   | `number` | Timestamp in milliseconds |
| `o`   | `string` | Open price                |
| `h`   | `string` | High price                |
| `l`   | `string` | Low price                 |
| `c`   | `string` | Close price               |
| `v`   | `string` | Volume                    |

**API Reference:** [GET /ohlcv](/api-reference/market-data#get-ohlcv)

***

## getOrderbook

Returns current orderbook snapshot with bids and asks.

```typescript theme={null}
import { getOrderbook } from '@lifi/perps-sdk';

const book = await getOrderbook(client, {
  provider: 'hyperliquid',
  marketId: 'BTC',
  depth: 20,
});

console.log('Best bid:', book.bids[0].price, book.bids[0].size);
console.log('Best ask:', book.asks[0].price, book.asks[0].size);
```

### Parameters

| Parameter         | Type                | Required | Description                                                                   |
| ----------------- | ------------------- | -------- | ----------------------------------------------------------------------------- |
| `client`          | `PerpsSDKClient`    | Yes      | SDK client                                                                    |
| `params.provider` | `string`            | Yes      | Provider identifier                                                           |
| `params.marketId` | `string`            | Yes      | The canonical `Market.id`                                                     |
| `params.depth`    | `number`            | No       | Number of price levels. The default varies by DEX; there is no fixed maximum. |
| `options`         | `SDKRequestOptions` | No       | Request options                                                               |

### Returns

`OrderbookResponse`:

| Field       | Type               | Description                        |
| ----------- | ------------------ | ---------------------------------- |
| `provider`  | `string`           | Provider identifier                |
| `marketId`  | `string`           | The canonical `Market.id`          |
| `bids`      | `OrderbookLevel[]` | Bid price levels (descending)      |
| `asks`      | `OrderbookLevel[]` | Ask price levels (ascending)       |
| `timestamp` | `number`           | Snapshot timestamp in milliseconds |

Each `OrderbookLevel`:

| Field   | Type     | Description              |
| ------- | -------- | ------------------------ |
| `price` | `string` | Price level              |
| `size`  | `string` | Size at this price level |

**API Reference:** [GET /orderbook](/api-reference/market-data#get-orderbook)

***

## getMeta

Get platform metadata: the backend `version` and the list of active platform-level `notices`. Provider-independent — reads the platform `meta` surface, so it takes no `provider`.

```typescript theme={null}
import { getMeta } from '@lifi/perps-sdk';

const { version, notices } = await getMeta(client);
```

### Parameters

| Parameter | Type                | Required | Description     |
| --------- | ------------------- | -------- | --------------- |
| `client`  | `PerpsSDKClient`    | Yes      | SDK client      |
| `options` | `SDKRequestOptions` | No       | Request options |

### Returns

`Meta` — `{ version: string; notices: Notice[] }`.

**API Reference:** [GET /meta](/api-reference/market-data#get-meta)

## getTermsAcceptance

Get the current terms-of-service document (version + full content) and whether a given address has accepted that version. Provider-independent — reads the platform `meta` surface.

```typescript theme={null}
import { getTermsAcceptance } from '@lifi/perps-sdk';

const terms = await getTermsAcceptance(client, '0x1234...');
if (!terms.accepted) {
  // prompt the user to accept terms.content (version terms.termsVersion)
}
```

### Parameters

| Parameter | Type                | Required | Description                                |
| --------- | ------------------- | -------- | ------------------------------------------ |
| `client`  | `PerpsSDKClient`    | Yes      | SDK client                                 |
| `address` | `Address`           | Yes      | Address whose acceptance status to resolve |
| `options` | `SDKRequestOptions` | No       | Request options                            |

### Returns

`TermsAcceptanceStatus` — `{ termsVersion: string; content: string; accepted: boolean; acceptedAt?: number }`.

**API Reference:** [GET /meta/terms](/api-reference/market-data#get-meta-terms)
