A comprehensive Python-based dashboard to track US inflation from 1913 to present and compare it against various assets including Bitcoin, Gold, currencies, and more.
- 📊 US Inflation Data: Historical CPI data from 1913 to present
- 💰 Real-time Prices: Live Bitcoin, Ethereum, Gold, and Silver prices
- 📉 Interactive Charts: Zoomable, pannable Plotly.js charts
- 🔄 Asset Comparison: Compare any combination of assets normalized to a base year
- 🧮 Inflation Calculator: Calculate the inflation-adjusted value of any amount
- 🌙 Modern Dark UI: Premium glassmorphism design with smooth animations
- Python 3.10 or higher
- pip (Python package manager)
-
Clone or navigate to the project directory:
cd "/Users/hishamfadhel/Library/CloudStorage/GoogleDrive-hfadhel140802@gmail.com/My Drive/Inflation"
-
Activate the virtual environment:
source venv/bin/activate -
Create your environment file (optional but recommended):
cp .env.example .env
Then edit
.envand add your API keys (see API Keys section below). -
Run the application:
python run.py
-
Open in browser: Navigate to http://localhost:5000
The application works without API keys using embedded historical data, but for real-time data, you'll need:
| API | Purpose | Get Key | Required? |
|---|---|---|---|
| FRED API | US CPI/Inflation data | fred.stlouisfed.org | Optional |
| Metals-API | Gold, Silver prices | metals-api.com | Optional |
| Alpha Vantage | Forex rates | alphavantage.co | Optional |
| Binance | Crypto prices | Not needed (public API) | N/A |
Create a .env file in the project root:
FRED_API_KEY=your_fred_api_key_here
METALS_API_KEY=your_metals_api_key_here
ALPHA_VANTAGE_API_KEY=your_alpha_vantage_api_key_hereInflation/
├── run.py # Application entry point
├── config.py # Configuration management
├── requirements.txt # Python dependencies
├── .env.example # Environment template
├── .env # Your API keys (gitignored)
│
├── app/
│ ├── __init__.py # Flask app factory
│ │
│ ├── routes/
│ │ ├── api.py # REST API endpoints
│ │ └── views.py # Page routes
│ │
│ ├── services/
│ │ ├── inflation_service.py # FRED/CPI data
│ │ ├── crypto_service.py # Binance integration
│ │ ├── metals_service.py # Precious metals
│ │ ├── forex_service.py # Currency exchange
│ │ └── cache_service.py # Response caching
│ │
│ ├── utils/
│ │ └── calculations.py # Inflation calculations
│ │
│ ├── static/
│ │ ├── css/style.css # Dark theme styles
│ │ └── js/dashboard.js # Frontend logic
│ │
│ └── templates/
│ ├── base.html # Base template
│ ├── index.html # Dashboard page
│ └── compare.html # Comparison page
│
└── venv/ # Virtual environment
| Endpoint | Description |
|---|---|
GET /api/inflation |
Historical CPI data |
GET /api/inflation/rates |
Year-over-year inflation rates |
GET /api/inflation/purchasing-power |
Purchasing power over time |
GET /api/inflation/adjust |
Inflation calculator |
| Endpoint | Description |
|---|---|
GET /api/crypto/<symbol> |
Current price (e.g., /api/crypto/bitcoin) |
GET /api/crypto/<symbol>/history |
Historical prices |
| Endpoint | Description |
|---|---|
GET /api/metals/<metal> |
Current price (gold, silver) |
GET /api/metals/<metal>/history |
Historical prices |
| Endpoint | Description |
|---|---|
GET /api/forex/<from>/<to> |
Exchange rate |
GET /api/forex/convert |
Currency conversion |
| Endpoint | Description |
|---|---|
POST /api/compare |
Compare multiple assets |
GET /api/dashboard |
All dashboard data |
GET /api/assets |
List available assets |
- Inflation/CPI: Bureau of Labor Statistics via FRED API (1913-present)
- Bitcoin: Binance API (2017-present) + embedded historical (2009-2016)
- Gold: Embedded historical data (1913-present)
- Silver: Embedded historical data (1970-present)
- Forex: Alpha Vantage API + embedded historical data
source venv/bin/activate
FLASK_DEBUG=True python run.pypip install <package-name>
pip freeze > requirements.txtThis project is for educational purposes. API usage is subject to the terms of each provider.
Contributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Add more asset data
- Improve the UI
Built with ❤️ using Flask & Plotly.js