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
- Clone this repository:
git clone https://github.com/versaucc/fredcollect.git
cd fredcollect
- Install the package:
pip install -e .
Quick Start
- Set up your FRED API key:
cp .env.example .env
# Edit .env and add your FRED API key
- 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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a41e30dae6df50ac63ed8fcdfb5e56126603879b2fa9ee7d96275f515f84369e
|
|
| MD5 |
1a2e0073eb7467654d7bc2624f1dee26
|
|
| BLAKE2b-256 |
208c76e564130449f7b2b96c86319c2bf24921708ce72435a9fde4d9da87f57a
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c61aea68e23e018a9c392b012a357d8fcb8885512bb3686e54ad36493cb1d63a
|
|
| MD5 |
05f329add9aabb83ec1790ecd034b86d
|
|
| BLAKE2b-256 |
8e289d81a3ca25733ac262077f191615e74e08b781100c1a04d2f2dfdf7ae723
|