Skip to content

download_bars


function backtide.data.download_bars(profiles, start=None, end=None, verbose=True)

Download OHLCV data for the instruments described in a list of profiles.

Concurrently downloads all instruments and legs, skipping data already stored in the database.

Parameters

profiles : list[InstrumentProfile]

Resolved instrument profiles (run resolve_profiles first).

start : int | None, default=None
Optional start of the download window (Unix timestamp, inclusive). When given, per-instrument ranges are clamped so that no data before this timestamp is requested. If None, it uses the provider's earliest available date.

end : int | None, default=None
Optional end of the download window (Unix timestamp, exclusive). When given, per-instrument ranges are clamped so that no data after this timestamp is requested. If None, it uses the provider's latest available date.

verbose : bool, default=True
Whether to display a progress bar while downloading.

Returns

DownloadResult

Summary of the download: succeeded/failed counts and per-task warnings.


See Also

query_bars

Return stored OHLCV bars as a dataframe.

fetch_instruments

Get instruments given their symbols.

resolve_profiles

Resolve the instrument profiles needed to download a set of symbols.


Example

>>> from backtide.data import resolve_profiles, download_bars

>>> profiles = resolve_profiles(["AAPL", "MSFT"], "stocks", "1d")
>>> result = download_bars(profiles)
>>> print(result)

DownloadResult(n_succeeded=2, n_failed=0, warnings=[])