get_category_children#

FredAPI.get_category_children(category_id, realtime_start=None, realtime_end=None)[source]#

Get a FRED Category’s Child Categories

Get the child categories for a specified category ID from the FRED API.

Parameters:
  • category_id (int) – The ID for the category whose children are to be retrieved.

  • realtime_start (str | datetime, optional) – The start of the real-time period. String format: YYYY-MM-DD.

  • realtime_end (str | datetime, optional) – The end of the real-time period. String format: YYYY-MM-DD.

Returns:

If multiple categories are returned.

Return type:

List[Category]

Raises:

ValueError – If the API request fails or returns an error.

Example

>>> import fedfred as fd
>>> fred = FredAPI('your_api_key')
>>> children = fred.get_category_children(13)
>>> for child in children:
>>>     print(child.name)
'Exports'
'Imports'
'Income Payments & Receipts'
'U.S. International Finance
FRED API Documentation:

https://fred.stlouisfed.org/docs/api/fred/category_children.html