Exchange Cache
In TypeScript, configurecreatePhoenixClient(...) with exchange metadata streaming, wait for client.exchange.ready(), then read markets from the cache.
client.ixs instruction builders read from client.exchange. The Rust PhoenixTxBuilder reads from PhoenixMetadata. Keep those caches warm before building orders so price, tick, base-lot, account, and risk-param conversions use the same market view as the rest of your app.
References:
- TypeScript unified client example
- TypeScript limit-order ix example
- Rust HTTP client example
- Rust limit-order example
Market Stats
Market stats carry live mark price, mid price, oracle price, funding, volume, and open interest. Subscribe for current values; do not poll market stats in a tight loop.metadata.apply_market_stats(&stats) updates the cached mark price inputs used by margin calculations.
The TypeScript stream adapter converts the raw WebSocket payload into camelCase. timestamp is a bigint in TypeScript and is shown as a string below for display:
GET /v1/market/{symbol}/stats.
References:
L2 Orderbook
Use the L2 stream when you need current book levels. Keep one subscription per symbol and fan out internally to your UI or strategy modules.API Polling
Polling is appropriate for startup snapshots, periodic reconciliation, or services that do not need live updates. It is not a substitute for WebSocket streams in a trading UI or market-making service.exchangeMetadata: { stream: true } when WebSocket access is available. In Rust, rebuild PhoenixMetadata from a fresh get_exchange() snapshot after reconnects or scheduled reconciliation, then continue applying market stats.
Market Metadata And Calendars
The exchange cache includes public market metadata used by apps, including labels and logo URIs where available. Treat these fields as display metadata; trading logic should use the market params and risk params from the cache. Commodity and equity markets can have session windows, after-hours bounds, reopen windows, and stale index behavior. The exchange cache exposes lightweight calendar metadata with the rest of the market snapshot so your UI can show the market’s current calendar source and the next known transition without another API call.getMarketCalendarById(id) when you start from the calendar id stored in exchange metadata. Rust currently exposes the symbol and commodity calendar helpers.
API reference:
GET /v1/market/{symbol}/market-calendarGET /v1/market-calendar/{market_calendar_id}GET /v1/market/{symbol}/next-market-calendar-transitionGET /v1/market/next-commodity-market-transitionGET /v1/market/commodity-calendar