__init__#

FredAPI.__init__(api_key, cache_mode=False, cache_size=256)[source]#

Initialize the FredAPI class that provides functions which query FRED data.

Parameters:
  • api_key (str) – Your FRED API key.

  • cache_mode (bool, optional) – Whether to enable caching for API responses. Defaults to False.

  • cache_size (int, optional) – The maximum number of items to store in the cache if caching is enabled. Defaults to 256.

Returns:

An instance of the FredAPI class.

Return type:

FredAPI

Raises:

ValueError – If the API key is not provided.

Example

>>> import fedfred as fd
>>> fred = fd.FredAPI('your_api_key')