Skip to main content

A Python wrapper for the Federal Reserve Economic Database (FRED) API

Project description

FredCollect

A modern Python wrapper for the Federal Reserve Economic Database (FRED) API.

Installation

From PyPI (recommended)

pip install fredcollect

From source

  1. Clone this repository:
git clone https://github.com/versaucc/fredcollect.git
cd fredcollect
  1. Install the package:
pip install -e .

Quick Start

  1. Set up your FRED API key:
cp .env.example .env
# Edit .env and add your FRED API key
  1. Verify the installation:
from fredcollect import run

Usage

Run a simple test:

from fredcollect import run  
print(run.run_series_updates())

This will print the first and last 5 rows of the most recently updated series. This doesn't however, retrieve the observed values that were updated to the series.

To do this we can take note of the id (series_id) and date:

from fredcollect import run
df = run.run_series_updates()
for row in df.loc[:,['id', 'title', 'last_updated']].itertuples(index=False):
    print(f"{row.title}:\n{run.run_series_observations(series_id=row.id, observation_start=row.last_updated)}") 

Will effortlessly fetch and print the series title and observations from that series. (I recommend adding a delay.)
Likely you will find it easier to create a batch file to collect data from instead of the CLI.
Take a look at tests/test.py to see usage examples of every possible FRED endpoint.
Following this, you'll want to peek at fredcollect/parameters.py to see what types of arguments can be made for each endpoint.

In progress

Currently, all endpoints make successful requests with required only parameters.
Except for series/observations - which cleans datetime objects
All functions can and will break when passed:
-Obscure arguments: like an extremely unpopular category id, discontinued series id, search text with certain symbols

Issues with string formatting are next up on the boilerplate.

Automated filesave:
-In /data_pipeline (currently obsolete) DataFrames and parameters passed here to automate the organization, naming, and saving of datasets.
-Maybe xlsx, likely csv.

MatplotLib:
-Graphing, matching, statarb, etc.

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Project details


Download files

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

Source Distribution

fredcollect-0.1.2.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

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

fredcollect-0.1.2-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file fredcollect-0.1.2.tar.gz.

File metadata

  • Download URL: fredcollect-0.1.2.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for fredcollect-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a41e30dae6df50ac63ed8fcdfb5e56126603879b2fa9ee7d96275f515f84369e
MD5 1a2e0073eb7467654d7bc2624f1dee26
BLAKE2b-256 208c76e564130449f7b2b96c86319c2bf24921708ce72435a9fde4d9da87f57a

See more details on using hashes here.

File details

Details for the file fredcollect-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: fredcollect-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for fredcollect-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c61aea68e23e018a9c392b012a357d8fcb8885512bb3686e54ad36493cb1d63a
MD5 05f329add9aabb83ec1790ecd034b86d
BLAKE2b-256 8e289d81a3ca25733ac262077f191615e74e08b781100c1a04d2f2dfdf7ae723

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