download.download_data_fred_md()
Download and process a FRED-MD / FRED-QD database (McCracken-Ng).
Usage
download.download_data_fred_md(
database="FRED-MD", transform=False, vintage="latest"
)Fetches a vintage of the FRED-MD (monthly) or FRED-QD (quarterly) macroeconomic database - a curated, balanced panel of macro series - as a wide table (one column per series, matching the other factor/predictor datasets). Each series has a McCracken-Ng stationarity transform code (tcode); transform=True applies it per series. FRED-MD/QD publish a new vintage every month, so a specific release can be requested by its YYYY-MM label - or the entire real-time panel with vintage='all' - for point-in-time analysis.
Parameters
database: str = "FRED-MD"-
Which database to download:
'FRED-MD'(monthly) or'FRED-QD'(quarterly). The frequency is implied by the database. transform: bool = False-
If
True, apply each series’ McCracken-Ng stationarity transform (tcode 1-7). IfFalse, return raw levels. vintage: str = "latest"-
Which release(s) to download:
'latest'(the current vintage), a'YYYY-MM'label for one historical release (e.g.'2020-03'; recent ones are hosted individually, older ones are extracted from the St. Louis Fed vintage archives), or'all'for every archived vintage stacked (the full real-time panel; FRED-MD reaches back to 1999-08, FRED-QD to 2018-05).
Returns
pl.DataFrame-
A wide data frame
['date', <series...>]. For a specificvintageor'all'a'vintage'column (theYYYY-MMrelease label) is inserted afterdate.
References
McCracken, M. W., and Ng, S. (2016). FRED-MD: A Monthly Database for Macroeconomic Research. Journal of Business & Economic Statistics, 34(4), 574-589. https://doi.org/10.1080/07350015.2015.1086655
McCracken, M. W., and Ng, S. (2021). FRED-QD: A Quarterly Database for Macroeconomic Research. Federal Reserve Bank of St. Louis Review, 103(1), 1-44. https://doi.org/10.20955/r.103.1-44
Examples
from tidyfinance import download_data
download_data("FRED", "FRED-MD")
download_data("FRED", "FRED-MD", transform=True)
download_data("FRED", "FRED-MD", vintage="2020-03")
download_data("FRED", "FRED-MD", vintage="all")
download_data("FRED", "FRED-QD")