quantlab.acquisition.fred#

Download FRED series through its key-free CSV endpoint.

FRED (Federal Reserve Economic Data, St. Louis Fed) serves every series as a CSV at fred.stlouisfed.org/graph/fredgraph.csv: id names the series, cosd and coed bound the observation dates. The endpoint needs no API key, so this vendor reads no credential at all. The answer is a header observation_date,<id> (DATE,<id> in FRED’s older format) and one row per date, with an empty value, or . in the older format, where FRED has no observation (a holiday); either becomes a null.

FredAcquisition treats each series id as a symbol of the shared SymbolBatchAcquisition base, which gives the download its resumable per-series watermark, its refresh() from that watermark and its daily raw tier (month=YYYY-MM/ shards with timestamp, symbol, vendor and value). quantlab.dataset.fred.FredRateDataset converts a rate series into a panel. refresh_raw_tier keeps series current under a download root (the daily update’s raw-tier refresh), and FRED_SOURCE at the bottom registers the vendor with it.

Examples#

Download the 3-month Treasury bill rate (network access, no key):

from quantlab.acquisition.config import AcquisitionConfig

acquisition = FredAcquisition(AcquisitionConfig(
    market="us_equity", frequency="1d", vendor="fred",
    raw_data_dir_path="/data/quantlab/downloads/us_equity/1d/macro/fred",
    watermark_path="/data/quantlab/downloads/us_equity/1d/macro/_watermarks/fred",
    symbols=("DTB3",), start_date="1954-01-04",
)).download()
acquisition.last_result.succeeded  # ('DTB3',)

Classes

FredAcquisition

Download FRED series, one series id per symbol, as a SymbolBatchAcquisition.

Functions

parse_csv

Return (timestamp, value) rows of one FRED CSV answer.

refresh_raw_tier

Download FRED series into <download_dir>/fred, each from its watermark.