PREVIEW · Proposed endpoints and dated plan snapshot · Not ready for public launch
navquote.
Menu
Historical data

Export historical OHLCV to CSV with Python

Fetch standard candles, map max and min to high and low, sort and deduplicate timestamps, and export a reproducible CSV with a separate request manifest.

NavQuote integration guides · Reviewed September 27, 2026

Local preview: neutral endpoints are pending live validation. Examples describe the current implementation contract; confirm endpoint availability and plan access before using them with live data.

Use the standard OHLCV endpoint when you need ordinary candles for a chart or analysis export. Normalize the returned fields at the edge of your application, preserve the request parameters, and inspect the actual time span instead of assuming a requested count is a complete dataset.

Request standard daily candles

Install requests and set API_KEY and NAVQUOTE_API_BASE in your server environment as described in the quickstart. Save the following as export_ohlcv.py and run python export_ohlcv.py. It writes two local files: candles.csv and candles.request.json.

The /api/price/ohlcv/{symbol} route explicitly requests standard candles. The generic price route can use a different candle construction by default, so it is not an interchangeable URL for this export.

Normalize names and ordering once

The raw candle uses max and min; the CSV renames these to high and low. The raw timestamp is time in Unix seconds. Sorting by that timestamp makes the output ascending regardless of response order. Identical duplicates are collapsed; conflicting values for one timestamp stop the export so they cannot be silently selected by array order.

A missing volume stays blank in the CSV. Volume units and meaning depend on the instrument, so do not infer a stock-share unit for every market. The helper validates price bounds; add a volume policy appropriate to the dataset before consuming it in an analysis pipeline.

Save enough context to reproduce the request

The manifest records the symbol, timeframe, adjustment, count and retrieval time without credentials. Keep it beside the CSV. Using the same ticker with a different adjustment can produce different historical values, so filenames alone are insufficient provenance.

range=10 requests ten candles, not ten days. Inspect the resulting first and last timestamp and row count. Do not include data.current as an extra row without checking whether it duplicates an item in history.

Check whether the dataset fits the task

The most recent candle may still change until its interval closes. A timestamp alone does not prove finality; use verified session boundaries and the response characteristics for your chosen market. Fewer returned rows may indicate limited availability, not a successful complete export.

For a bounded analysis period, follow the historical window guide and filter the returned timestamps explicitly. This example demonstrates data preparation; it does not establish exchange coverage, uniform historical depth or suitability for a trading strategy.

Build your first working request.

One account for API keys, usage and subscriptions.

Get API Key

Continue to our shared account console.