This project is a web application that visualizes U.S. inflation data from the Federal Reserve Economic Data (FRED) API. The user can view inflation trends over a custom period of time (e.g., 2020 to 2024) and see normalized inflation rates.
- Fetches U.S. inflation data from FRED API.
- Allows users to select a custom date range to visualize inflation.
- Plots the normalized inflation data (relative to the selected time period).
- Interactive and dynamic visuals generated with Matplotlib.
- Environment variables for API key management.
- Python 3.8+
- Flask
- Matplotlib
- Pandas
- Requests
- Dotenv
-
Clone this repository:
git clone https://github.com/ivansing/inflation-tracker.git cd inflation-tracker
-
Create a virtual environment
python3 -m venv venv source venv/bin/activate # on Windows use: venv\Scripts\activate
-
Install -r requirements.txt
To access U.S. inflation data, you need a FRED API key. Follow the steps to get yours:
1. Go to [FRED website](https://fred.stlouisfed.org/)
2. Create a free account or sign in if you already have one.
3. Navigate to My Account > API Keys.
4. Click on Reuqests API Key and follow the instructions to generate your key.
5. Once you have the API key, copy it into the `.env` file as shown below.
-
Set up the
.env
file in the root directory with your FRED API key:API_KEY=your_fred_api_key_here
-
Run the Flask application:
python3 app.py
-
Visit the app in your browser at
http://127.0.0.1:5000
. -
Enter the desired start and end years in integer values on the UI to see inflation trends.
You can test the application by running it locally and entering a custom date range (for example, 1990 to 2024) in the web interface to see how the inflation data is plotted.
This project is licensed under the MIT license. See the LICENSE file for more information.