polaris-data.
Install
Quickstart
Usereplay(...) when you want to stream historical rows in a script or backfill job. You can run this without an API key set.
Create a client
If you omitapiKey, the client reads POLARIS_API_KEY from the environment.
Core methods
UsePolarisClient for discovery, historical replay, and direct query workflows.
from and to accept ISO 8601 strings, Date objects, or Unix epoch milliseconds (number).
stream, replay, events, and l2Snapshots reconstruct standardized
orderbooks by default. Snapshots replace the complete state, deltas update
listed prices, and zero quantity deletes a price. Books clear across gaps and
reconnects, with deltas skipped until a new snapshot. Use l2Updates(...) for
raw snapshots and deltas, then feed selected updates into the exported
OrderbookBuilder for application-managed books.
Match event schema versions
StandardEvent is the structural LegacyStandardEvent | StandardEventV2
union. Check for collector_timestamp before reading version-specific fields:
Discover a market before you query it
Usecatalog(...) to find the exact Polaris market ID for a venue.
Query events
Useevents(...) when you want standardized historical event rows beyond trades alone.
Query trades
trades(...) returns a list of normalized trade events. The SDK handles pagination and snapshot-backed historical reads for you.
Query intents and RFQs
intents(...) returns typed RFQ, quote, executable-intent, and settlement
observations in stored order. Use market: "intents" and correlate rows by their
captured rfq_id or intent_id.
Query option tickers
UseoptionTickers(...) with an underlying market such as BTC. Omit
instrument for the whole option chain, or provide one exact venue-native
contract.
source, the normalized underlying market,
and the non-empty exact instrument separate. See
Option tickers for the payload fields and realtime
filtering behavior.
Query OHLCV bars
Useohlcv(...) when you want interval bars instead of individual trades.
format: "tradingview", ohlcv(...) returns TradingView-style candle and volume arrays.
The OHLCV aggregation engine preserves precision by scaling volume by 1e12 during accumulation to avoid floating-point drift.
Query order book snapshots
Usel2Snapshots(...) when you need order book depth data for microstructure analysis.
l2Updates(...) when you want to manage reconstruction in your
application:
update() changes state without constructing a complete object. snapshot()
creates sorted levels only when requested. Use apply() when you need the
previous update-and-materialize behavior.
Query funding rates
UsefundingRates(...) to analyze perpetual funding rates and carry modeling.
Query mark prices
UsemarkPrices(...) for basis analysis, mark tracking, and liquidation-related research.
Query volume profiles
Usevolume(...) for volume profiling and participation analysis.
Query VWAP series
Usevwap(...) for execution benchmarking and price smoothing.
Query volatility series
Usevolatility(...) for risk modeling and intraperiod volatility analysis.
Query best bid/offer
Usebbo(...) for spread tracking, quote analytics, and top-of-book monitoring.
Query depth metrics
UsedepthMetrics(...) for liquidity analysis and market impact estimation.
Local dataset storage
The SDK stores standardized snapshots and local day files under a shared Polaris app-data root so the TypeScript SDK and other Polaris tools can reuse the same files. Default roots:- macOS:
~/Library/Application Support/polaris - Linux:
$XDG_DATA_HOME/polarisor~/.local/share/polaris - Windows:
%APPDATA%\polaris
datasetRoot to the constructor to override the root explicitly.
Snapshot-first replay
For standardized historical data,replay(...), events(...), trades(...), and default or TradingView ohlcv(...) prefer /snapshots and /download, then read local day files when they already exist. See Snapshots for the full flow.
Authentication
Public sources (e.g. Hyperliquid BTC) work without an API key. For premium sources, raw snapshots, or extended history, set your key via thePOLARIS_API_KEY environment variable or pass it directly:
Error handling
The SDK uses a custom error class hierarchy rooted atPolarisError.