polaris-data.
Install
uv, install it into a project with:
Quickstart
Usereplay(...) when you want to stream historical rows in a notebook, script, or backfill job. You can run this without an API key set, and from_ and to are optional. If you omit them, the SDK uses the most recent available window up to the last 7 days of data, or the public cutoff date for preview datasets.
Create a client
If you omitapi_key, 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, datetime, date, or Unix epoch microseconds. They are optional on replay(...), events(...), trades(...), raw(...), and ohlcv(...). If you omit either boundary, the SDK fills the request from the most recent available window up to the last 7 days of data, or the public cutoff date for preview datasets.
For historical event queries, standard=True is the default on replay(...). Pass standard=False when you explicitly want raw schema payloads through replay.
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. Omit from_ and to to query the recent default window, or pass them explicitly when you need a fixed range.
Query trades
trades(...) returns a list of normalized trade events. The SDK handles pagination and snapshot-backed historical reads for you. from_ and to are optional, so you can start with the recent default window and only add explicit boundaries when you need a specific range.
Query OHLCV bars
Useohlcv(...) when you want interval bars instead of individual trades. from_ and to are optional here as well.
format="tradingview", ohlcv(...) returns TradingView-style candle and volume arrays.
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 day files under a shared Polaris app-data root so the Python SDK and CLI 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=... to PolarisClient(...) 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 default or TradingView ohlcv(...) prefer /snapshots and /snapshots/download, then read local day files when they already exist. This applies whether you pass an explicit range or rely on the default recent window.
/events?format=file flow for standardized replay, event, trade, and local OHLCV derivation.
Authentication
Public sources (e.g. Binance BTC-USDT) 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
Notebook workflow
If you want a notebook that discovers a market, loads a DataFrame, and plots a chart, start with Example Notebooks.Next steps
- Read Example Notebooks if you want notebook-ready workflows with pandas and matplotlib.
- Read Catalog before you hardcode source and market IDs.
- Read Authentication if you want the shared auth model behind the SDK.
- Read Snapshots if your Python workflow starts from historical files.
- Read Trades, Events, or OHLCV for detailed method documentation.