Repository navigation
v0.1.0
Initial release: the St. Louis Fed's FRED and ALFRED economic data in the fleet's connector idiom, built vintage-first.
In plain English: this package fetches official US economic statistics — GDP, unemployment, money supply, financial-conditions indices, the dollar, Treasury yields — through one typed, tested interface that works both synchronously and asynchronously. Unlike the general-purpose alternatives, it treats vintages (what each number was known to be at each point in the past) as a first-class surface, so a backtest can use the numbers a trader actually had then rather than today's revised history — the difference between an honest backtest and a look-ahead illusion.
FredSeries: the client, over the sharedconnectcoretransport, with sync + async threaded from the constructor. Methods:get_series()(observations at any real-time window — the latest values are simply today's window, never a separate code path);get_series_vintages()(the headline — the ALFREDoutput_type=1as-known-then long form);get_series_info()(metadata, including the revision-cadence notes);search_series();get_releases(); andget_release_dates().- Vintage-first, point-in-time honest.
get_series_vintages()returns one row per (observation date, real-time window), each carrying the value current during that window; arealtime_endof"9999-12-31"means still current. The whole-history matrix of a heavily-revised series exceeds FRED's 100,000-row response cap, so it is pulled in disjoint offset pages that stitch back to the un-paged whole with no seam clip, skip, or duplicate — the offset-pager logic proven live in the data-scraper's src/fred collector (NFCI's 906,899 rows reassemble byte-identical) is ported here into typed form, and its seam-stitching proof is a unit test. - Faithful typed shapes (
FredObservations,FredVintages,FredSeriesInfo,FredReleases,FredReleaseDates) with every column documented as typed bullets — the observation value isnumeric | NAbecause FRED serves.for a missing observation (which becomesNA, never0); the observation date and real-time-window bounds are structural and strict. - Typed conditions from birth:
fred_api_errorlayered in front of theconnectcoretransport chain (carryingstatus, FRED's own bodyerror_code, a key-redactedurl, and abody_snippet);fred_validation_errorunder thefred_errordomain root. A test proves the API key is redacted from every stored URL. - Grounded against the live API's error envelope (a real non-2xx status plus a JSON
{error_code, error_message}body — a missing/invalid key is a plain HTTP 400, no HTML redirect to disentangle) and fully-synthetic mock fixtures offline. Live tests (get_series, vintages, metadata, search, releases) gate onFRED_LIVE_TESTSand a working key; every FRED endpoint needs a key, so there is no keyless surface.