polaris-data.
Install
polaris-data and the crate name is polaris_data.
Or add it manually to Cargo.toml:
Quickstart
Useevents(...) when you want standardized historical rows in an async service or backfill job.
Create a client
If you omitapi_key, the client reads POLARIS_API_KEY from the environment.
Core methods
UsePolarisClient for discovery and snapshot-backed historical queries.
from and to accept ISO 8601 strings, chrono::DateTime<Utc>, or Unix epoch microseconds as i64 or u64. If you omit one or both bounds, the SDK infers a bounded historical range from catalog metadata, using the latest 7 days by default and applying public cutoff rules for preview datasets when no API key is present.
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 normalized trade events. The SDK loads standardized snapshot data locally and filters trade rows for you.
Query OHLCV bars
Useohlcv(...) when you want interval bars instead of individual trades.
100ms, 1s, 10s, 1m, 5m, 15m, and 1h.
Query order book snapshots
Usel2_snapshots(...) when you need order book depth data for microstructure analysis.
Query funding rates
Usefunding_rates(...) to analyze perpetual funding rates and carry modeling.
Query mark prices
Usemark_prices(...) 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
Usedepth_metrics(...) for liquidity analysis and market impact estimation.
Local dataset storage
The SDK stores standardized snapshots and local cache data under the shared Polaris app-data root so the Rust 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
dataset_root(...) on the builder to override the root explicitly.
POLARIS_ROOToverrides the shared root globally.POLARIS_DATASET_DOWNLOAD_DIRis still accepted as a deprecated compatibility override.
Snapshot-first replay
For standardized historical data,replay(...), events(...), trades(...), and ohlcv(...) use a snapshot-first flow:
- Discover snapshot files through
/snapshots. - Download missing
.jsonl.zstfiles through/download. - Cache them locally under the Polaris data root.
- Reuse local files on subsequent reads instead of making repeat network calls.
/events, /trades, /ohlcv, or /raw endpoints.
Gap handling
By default, snapshot-backed methods fail if the requested range is not fully covered by available standardized snapshots. Setallow_gaps: true when you want the SDK to:
- return only covered rows
- skip missing intervals
- emit a
log::warn!entry describing the gaps
Authentication
Public sources work without an API key. For premium sources or extended history, set your key viaPOLARIS_API_KEY or configure it directly on the builder:
Next steps
- Read Authentication if you want the shared auth model behind the SDK.
- Read Snapshots if your Rust workflow starts from historical files.
- Read Trades, Events, or OHLCV for detailed method documentation.