Skip to main content

A feature-rich python package for interacting with the Federal Reserve Bank of St. Louis Economic Database: FRED

Project description

fedfred

A feature-rich python package for interacting with the Federal Reserve Bank of St. Louis Economic Database: FRED

FedFred Logo
Build and test GitHub Analyze Status Test Status CodeQL Code Coverage Packaging status PyPI version PyPI Downloads Conda-Forge version Conda-Forge downloads DOI

Features

  • Now available on Conda-Forge!
  • Pandas/Polars/Dask DataFrame native support.
  • GeoPandas/Polars-ST/Geopandas-Dask GeoDataframe native support
  • Native support for asynchronous requests (async).
  • Local caching for easier data access and faster execution times.
  • Built-in rate limiter that doesn't exceed 120 calls per minute (ignores local caching).

Installation

You can install the package using pip:

pip install fedfred

Or install from conda-forge:

conda install -c conda-forge fedfred

For type checking support, install with optional type stubs:

pip install fedfred[types]

For use with Polars DataFrames and GeoDataFrames, install with:

pip install fedfred[polars]

For use with Dask DataFrames and GeoDataFrames, install with:

pip install fedfred[dask]

We recommend using a virtual environment with either installation method.

Rest API Usage

I recommend consulting the documentation at: https://nikhilxsunder.github.io/fedfred/

Here is a simple example of how to use the package:

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

# Get Series Observations as a pandas DataFrame
gdp = fred.get_series_observations('GDP')
gdp.head()

# Get Series Observations as a pandas DataFrame (async)
import asyncio
async def main():
    fred = fd.FredAPI(api_key).Async
    gdp = fred.get_series_observations('GNPCA')
    print(observations.head())
asyncio.run(main())

Important Notes

  • Store your API keys and secrets in environment variables or secure storage solutions.
  • Do not hardcode your API keys and secrets in your scripts.
  • XML filetype (file_type='xml') is currently not supported but will be in a future update

Continuous Integration

FedFred uses GitHub Actions for continuous integration. The following workflows run automatically:

  • Build and Test: Triggered on every push and pull request to verify the codebase builds and tests pass
  • Analyze: Runs static code analysis to identify potential issues
  • Test: Comprehensive test suite with coverage reporting
  • CodeQL: Security analysis to detect vulnerabilities
  • Docs: Deploys Github Pages website for documentation, built off of sphinx docs.

These checks ensure that all contributions maintain code quality and don't introduce regressions.

Status badges at the top of this README reflect the current state of our CI pipelines.

Development

FedFred uses standard Python packaging tools:

  • Poetry: For dependency management and package building
  • pytest: For testing
  • Sphinx: For documentation generation

To set up the development environment:

# Install Poetry
curl -sSL https://install.python-poetry.org | python3 -

# Clone the repository
git clone https://github.com/nikhilxsunder/fedfred.git
cd fedfred

# Install dependencies
poetry install

# Run tests
poetry run pytest

Testing

The project uses pytest as its testing framework. Tests are located in the tests/ directory.

To run the complete test suite:

poetry run pytest

For running tests with coverage reports:

poetry run pytest --cov=fedfred tests/

To run a specific test file:

poetry run pytest tests/specific_module_test.py

Test Coverage

We aim to maintain a minimum of 80% code coverage across the codebase. This includes:

  • Core functionality: 90%+ coverage
  • Edge cases and error handling: 80%+ coverage
  • Utility functions: 75%+ coverage

Continuous integration automatically runs tests on all pull requests and commits to the main branch.

Test Policy

FedFred requires tests for all new functionality. When contributing:

  • All new features must include appropriate tests
  • Bug fixes should include tests that verify the fix
  • Tests should be added to the automated test suite in the tests/ directory

Security

For information about reporting security vulnerabilities in FedFred, please see our Security Policy.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

Citation

If you use fedfred in your research, projects, or publications, please cite it as follows:

Plain Text:

Sunder, Nikhil. (2025). fedfred: A Python client for the Federal Reserve Economic Database (FRED) API.
Version 2.1.5. Available at: https://github.com/nikhilxsunder/fedfred

BibTeX:

@software{fedfred,
  author       = {Nikhil Sunder},
  title        = {fedfred: A Python client for the Federal Reserve Economic Database (FRED) API},
  year         = {2025},
  publisher    = {GitHub},
  version      = {2.1.5},
  doi          = {10.5281/zenodo.17180397},
  url          = {https://github.com/nikhilxsunder/fedfred},
  orcid        = {https://orcid.org/0009-0007-3323-1760}
}

You can also download a ready-made citation file from the GitHub repository

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fedfred-3.0.0.tar.gz (45.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fedfred-3.0.0-py3-none-any.whl (47.4 kB view details)

Uploaded Python 3

File details

Details for the file fedfred-3.0.0.tar.gz.

File metadata

  • Download URL: fedfred-3.0.0.tar.gz
  • Upload date:
  • Size: 45.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.10.19 Linux/6.11.0-1018-azure

File hashes

Hashes for fedfred-3.0.0.tar.gz
Algorithm Hash digest
SHA256 5742ff591b37d49b18a856f98e6fc45953ba8227e48aaf7b3c7c2d9d59e14e06
MD5 0ff914ab1e1dd023fb72fd310a19064a
BLAKE2b-256 7d10e22e11c321acd9ca69523fdecfbb4f92e7c7dffe3e492020d1a5d99e8a9c

See more details on using hashes here.

File details

Details for the file fedfred-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: fedfred-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 47.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.10.19 Linux/6.11.0-1018-azure

File hashes

Hashes for fedfred-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a9c0f52f22e57a7a3dc363bd5cb6fd618f122fcf0f7a3aca9bc74f7685e7f50
MD5 cbe7f16445f0ec0276fd4361dcb481c2
BLAKE2b-256 24edf277ed91f2950ba4196d3cf29241e453ab3ddc52f752bdf12fcabb793af7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page