The examples on this page use Hyperliquid (
provider: 'hyperliquid'). Replace the provider value with any supported DEX from getProviders().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 onMarket via getMarkets; live data (mark price, funding) lives on MarketPrice via getPrices.
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’s numeric asset_id stringified; Hyperliquid coin symbol) |
displaySymbol | string | UI-friendly base symbol (e.g., "BTC", "PURR") |
logoURI | string | URL to asset logo |
displayName | string? | Full asset name (e.g., "Bitcoin") |
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 fromgetPrices.
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 |
PerpsMarket adds:
| Field | Type | Description |
|---|---|---|
maxLeverage | number | Maximum allowed leverage |
onlyIsolated | boolean | Whether only isolated margin is supported |
getPrices.
API Reference: GET /markets
getMarket
Returns a single market by its canonicalmarketId.
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
getPrices
Returns live per-market data for all markets: the midprice, markPrice, prevDayPrice, and volume24h for every market, plus openInterest and funding for perps. Intended for frequent polling; pair it with the static metadata from getMarkets.
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: MarketPrice[] }:
Each MarketPrice:
| Field | Type | Description |
|---|---|---|
marketId | string | The canonical Market.id |
price | string | Current mid price |
markPrice | string | Current mark price |
prevDayPrice | string? | Previous day’s price |
volume24h | string? | 24-hour trading volume in USD |
openInterest | string? | Total open interest in USD (perps markets only) |
funding | FundingInfo? | Current funding rate and next funding time (perps markets only) |
getOhlcv
Returns OHLCV candle data for charts.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 |
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 |
getOrderbook
Returns current orderbook snapshot with bids and asks.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 (default 20, max 100) |
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 |
OrderbookLevel:
| Field | Type | Description |
|---|---|---|
price | string | Price level |
size | string | Size at this price level |