The examples on this page use Hyperliquid (
provider: 'hyperliquid'). Replace the provider value with any supported provider key from getProviders().getAssets
Returns the token/asset registry for a specified provider — 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 MarketContext via getMarketsContext.
Parameters
Returns
AssetsResponse — { assets: Asset[] }:
Each Asset:
API Reference: GET /assets
getMarkets
Returns the active markets for a specified provider as static instrument metadata — ids, base/quote assets, decimals, leverage, and margin. Delisted markets are dropped by the SDK and never appear in the result. Live data (mark price, funding, open interest, volume) comes fromgetMarketsContext.
Parameters
Returns
MarketsResponse — { markets: Market[] }. A Market is either a PerpsMarket or a SpotMarket; both extend BaseMarket:
Do not apply
priceDecimals, priceIncrement, or sizeIncrement directly to order values. Prices and sizes must sit on the venue grid or the order is rejected, so format them through the provider plugin — see Provider plugin snapping.
PerpsMarket adds:
Live per-market data (mark price, previous-day price, 24h volume, open interest, funding) comes from
getMarketsContext.
API Reference: GET /markets
getMarket
Returns a single market by its canonicalmarketId. The result is the Market union (PerpsMarket | SpotMarket), so narrow it before reading perps-only fields such as maxLeverage. Throws PerpsError with code MarketNotFound (2023) when the id is unknown or the market is delisted.
Parameters
Returns
Market — single market object (same shape as above).
API Reference: GET /markets
Default market
DEFAULT_MARKET_ID gives the market a caller lands on when it names none, keyed by provider and given as the venue’s own Market.id:
getDefaultMarketId(provider: DefaultMarketProvider): string reads a single provider’s default market id from DEFAULT_MARKET_ID. DefaultMarketProvider is 'hyperliquid' | 'lighter' | 'ondo'. Each value is a fixed deployment fact, so it needs no runtime lookup.
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.
Parameters
Returns
PricesResponse — { prices: MarketContext[] }:
Each MarketContext:
API Reference: GET /marketsContext
getOhlcv
Returns OHLCV candle data for charts.Parameters
Returns
OhlcvResponse:
Each
Candle:
API Reference: GET /ohlcv
getOrderbook
Returns current orderbook snapshot with bids and asks.Parameters
Returns
OrderbookResponse:
Each
OrderbookLevel:
API Reference: GET /orderbook
getMeta
Get platform metadata: the backendversion and the list of active platform-level notices. Provider-independent — reads the platform meta surface, so it takes no provider.
Parameters
Returns
Meta — { version: string; notices: Notice[] }. Each Notice:
API Reference: 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 platformmeta surface.
Parameters
Returns
TermsAcceptanceStatus — { termsVersion: string; content: string; accepted: boolean; acceptedAt?: number }.
API Reference: GET /meta/terms
getReferralStatus
Get an address’s onboarding and internal-referral state: terms acceptance, its attached and owned codes, whether it may create a code, and the verdict on a candidate code. Provider-independent — reads the platformmeta surface.
Parameters
Returns
ReferralStatus — { address, termsVersion, termsAccepted, attachedCode?, ownedCode?, ownedCodeEligibility, candidate?, onboarding? }. An address the backend holds no record for resolves to termsAccepted: false with the optional fields absent.
onboarding is the one onboarding step the address still has to sign: { termsVersion?, referralCode? }, where each present field is carried by the step. Pass the same values to submitOnboarding. It is absent when the backend requires no consent from this address.
Referral code validation
candidate is a ReferralCodeValidation verdict on the code query param: { code, valid, normalizedCode?, rejection? }. code echoes the candidate, valid reports whether the backend accepts it, normalizedCode carries the backend’s canonical form when it differs from code, and rejection names the reason when valid is false.
rejection is a ReferralCodeRejection value:
getReferralActivity
Get the addresses attached toaddress’s owned internal referral code, paginated. Provider-independent — reads the platform meta surface.
Parameters
Returns
ReferralActivityResponse — { items: ReferralActivityItem[]; pagination: Pagination }. Each item is { address, attachedAt, notional }. An address that owns no code resolves to items: [].