quantlab.acquisition.fred.FredAcquisition#

class quantlab.acquisition.fred.FredAcquisition(config)[source]#

Bases: SymbolBatchAcquisition

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

The endpoint answers one series over the whole requested window, so a batch is one series and _fetch_page never returns a page token. A 429, a 5xx or a dropped connection is retried by the base class’s request policy (the server’s Retry-After, or a back-off doubling from 2 s, five times); any other error fails that series alone. No credential exists to read or scrub.

A series’ watermark is its last date with a value, not the requested end: FRED publishes a day’s rate the next business day, so a download run on that day would otherwise mark a day as covered before it exists, and refresh(), which starts at the watermark, would never fetch it.

Parameters:
configAcquisitionConfig

vendor is "fred", frequency "1d" and symbols the series ids.

Examples

With config as in the module example:

FredAcquisition(config).refresh()  # fetches from each series' watermark on
DEFAULT_BATCH_SIZE = 1#

One series per request: the endpoint takes one id.

RAW_COLUMNS = ('timestamp', 'symbol', 'vendor', 'value')#

Shard columns: the base’s three, then the published value.

VENDOR = 'fred'#

Which vendor this subclass fetches from. Set by every subclass. It is written into every shard as a literal vendor column and hashed into every PageLedger.batch_key, so changing it changes the files.