import qrt as q
aapl = q.data.datasets.load("aapl")Market data sources
Each vendor/backend is its own submodule under q.data.sources, all returning the same lowercase-column OHLCV DataFrame layout consumed by q.indicator and q.stats. These examples hit the network, so they’re shown but not executed here:
# Yahoo Finance — cached locally as parquet after the first call
ohlc = q.data.sources.yfinance.read("AAPL", "2024-01-01", "2025-01-01", "1d")
# Binance futures — daily trade dumps aggregated into OHLC bars, also cached
ohlc = q.data.sources.binance.read("BTCUSDT", "2025-01-01", "2025-01-07", "1h")q.data.sources.duckdb is different: rather than a fixed schema/vendor, it reads and writes arbitrary tables in a DuckDB database, keyed by symbol and datetime. It works offline (:memory: by default), so we can run it live:
table = aapl.tail(30).reset_index()
table.insert(1, "symbol", "AAPL")
db = q.data.sources.duckdb.connect() # in-memory
db.write(table)
db.read("AAPL", table["datetime"].min(), table["datetime"].max()).tail()| datetime | symbol | open | high | low | close | volume | |
|---|---|---|---|---|---|---|---|
| 25 | 2026-07-20 | AAPL | 333.510010 | 333.709991 | 323.679993 | 326.589996 | 53468000 |
| 26 | 2026-07-21 | AAPL | 323.130005 | 329.600006 | 322.220001 | 327.739990 | 41338900 |
| 27 | 2026-07-22 | AAPL | 327.869995 | 329.000000 | 323.339996 | 325.890015 | 38755900 |
| 28 | 2026-07-23 | AAPL | 321.730011 | 323.299988 | 319.350006 | 321.660004 | 40840800 |
| 29 | 2026-07-24 | AAPL | NaN | NaN | NaN | NaN | 47460975 |