client.ohlcv() when you want interval-based bar data instead of raw executions. This method aggregates OHLCV bars from standardized trade data. OHLCV data is interval-aligned and deterministic: candle boundaries are fixed to UTC intervals, which keeps joins and cross-venue aggregation consistent.
Method signature
Parameters
| Parameter | Type | Required | Notes |
|---|---|---|---|
| source | str | Yes | Source ID |
| market | str | Yes | Normalized market or instrument ID |
| from_ | str/datetime/date/int | Yes | Inclusive start time (ISO 8601, datetime, date, or epoch microseconds) |
| to | str/datetime/date/int | Yes | Exclusive end time (same formats as from_) |
| interval | str | Yes | Duration token such as 1m, 5m, 1h |
| format | str | No | Response format: None (default JSON), "tradingview" for TV-compatible JSON |
POLARIS_API_KEY environment variable or pass api_key to PolarisClient().
Return value
- Default: List of OHLCV bar dictionaries
- With
format="tradingview": Dictionary withcandlesandvolumesarrays
Example response
Fields
The default response is a list of bar dictionaries with these fields:timestamp: bar open time in UTC microseconds since the Unix epochopen,high,low,close: interval pricesvolume: traded base volume for the bartrades: number of trades aggregated into the barinterval: duration token such as1m,5m, or1h
/events or snapshot files, it uses the standard event envelope (see Standardised formats) and the bar-specific fields live under the nested data object.
Example
TradingView format
If you passformat="tradingview", the response uses these fields:
candles[].time: Unix secondscandles[].open,candles[].high,candles[].low,candles[].closevolumes[].time: Unix secondsvolumes[].value: bar volume
How it works
client.ohlcv() aggregates bars from standardized trade data using snapshot-first replay. The SDK queries the /snapshots endpoint for historical data, reads from local cached files when available, and derives OHLCV bars from the underlying trade events. The SDK handles pagination and data derivation automatically.
For more details on snapshot-based queries, see Snapshots.
Related documentation
- Standardised formats for the full event envelope OHLCV bars are nested in inside event streams
- Trades if you need execution-level data instead of bars
- Snapshots for bulk historical standardized files
- Authentication