File size: 8,399 Bytes
099d8d9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
# FRED ML - Real-Time Economic Analytics Platform
[](https://opensource.org/licenses/Apache-2.0)
[](https://www.python.org/downloads/)
[](https://streamlit.io/)
A comprehensive real-time economic analytics platform that leverages the Federal Reserve Economic Data (FRED) API to provide advanced economic insights, forecasting, and visualization capabilities.
## ๐ Features
### ๐ Real-Time Economic Data
- **Live FRED API Integration**: Direct connection to Federal Reserve Economic Data
- **12+ Economic Indicators**: GDP, CPI, Unemployment, Industrial Production, and more
- **Real-Time Updates**: Latest economic data with automatic refresh
- **Data Validation**: Robust error handling and data quality checks
### ๐ฎ Advanced Analytics
- **Economic Forecasting**: Time series analysis and predictive modeling
- **Correlation Analysis**: Spearman correlations with z-score standardization
- **Growth Rate Analysis**: Year-over-year and period-over-period calculations
- **Statistical Modeling**: Comprehensive statistical analysis and insights
### ๐ Interactive Visualizations
- **Time Series Charts**: Dynamic economic indicator trends
- **Correlation Heatmaps**: Interactive correlation matrices
- **Distribution Analysis**: Statistical distribution visualizations
- **Forecast Plots**: Predictive modeling visualizations
### ๐ฏ Key Insights
- **Economic Health Scoring**: Real-time economic health assessment
- **Market Sentiment Analysis**: Bullish/bearish market indicators
- **Risk Factor Analysis**: Comprehensive risk assessment
- **Opportunity Identification**: Strategic opportunity analysis
### ๐ฅ Data Export & Downloads
- **CSV Export**: Raw economic data downloads
- **Excel Reports**: Multi-sheet analysis reports
- **Bulk Downloads**: Complete data packages
- **Visualization Downloads**: High-quality chart exports
## ๐ ๏ธ Technology Stack
- **Frontend**: Streamlit (Python web framework)
- **Data Processing**: Pandas, NumPy
- **Visualization**: Plotly, Matplotlib
- **API Integration**: FRED API (Federal Reserve Economic Data)
- **Cloud Storage**: AWS S3 (optional)
- **Deployment**: Docker, Hugging Face Spaces
## ๐ Prerequisites
- Python 3.11 or higher
- FRED API key (free from [FRED](https://fred.stlouisfed.org/docs/api/api_key.html))
- Git
## ๐ Installation
### 1. Clone the Repository
```bash
git clone https://github.com/yourusername/FRED_ML.git
cd FRED_ML
```
### 2. Install Dependencies
```bash
pip install -r requirements.txt
```
### 3. Set Up Environment Variables
Create a `.env` file in the project root:
```bash
FRED_API_KEY=your_fred_api_key_here
```
Or set the environment variable directly:
```bash
export FRED_API_KEY=your_fred_api_key_here
```
### 4. Get Your FRED API Key
1. Visit [FRED API Key Registration](https://fred.stlouisfed.org/docs/api/api_key.html)
2. Sign up for a free account
3. Generate your API key
4. Add it to your environment variables
## ๐ฏ Quick Start
### Local Development
```bash
# Start the Streamlit app
streamlit run frontend/app.py --server.port 8501
```
### Docker Deployment
```bash
# Build the Docker image
docker build -t fred-ml .
# Run the container
docker run -p 8501:8501 -e FRED_API_KEY=your_key_here fred-ml
```
### Hugging Face Spaces
The app is automatically deployed to Hugging Face Spaces and can be accessed at:
[FRED ML on Hugging Face](https://huggingface.co/spaces/yourusername/fred-ml)
## ๐ Usage
### 1. Executive Dashboard
- **Real-time economic metrics**
- **Key performance indicators**
- **Economic health scoring**
- **Market sentiment analysis**
### 2. Economic Indicators
- **Interactive data exploration**
- **Real-time data validation**
- **Growth rate analysis**
- **Statistical insights**
### 3. Advanced Analytics
- **Comprehensive analysis options**
- **Forecasting capabilities**
- **Segmentation analysis**
- **Statistical modeling**
### 4. Reports & Insights
- **Real-time economic insights**
- **Generated reports**
- **Market analysis**
- **Risk assessment**
### 5. Downloads
- **Data export capabilities**
- **Visualization downloads**
- **Bulk data packages**
- **Report generation**
## ๐ง Configuration
### Environment Variables
| Variable | Description | Required |
|----------|-------------|----------|
| `FRED_API_KEY` | Your FRED API key | Yes |
| `AWS_ACCESS_KEY_ID` | AWS access key (for S3) | No |
| `AWS_SECRET_ACCESS_KEY` | AWS secret key (for S3) | No |
### API Configuration
The app supports various FRED API endpoints:
- **Economic Indicators**: GDP, CPI, Unemployment, etc.
- **Financial Data**: Treasury yields, Federal Funds Rate
- **Employment Data**: Nonfarm payrolls, labor statistics
- **Production Data**: Industrial production, capacity utilization
## ๐ Data Sources
### Primary Economic Indicators
- **GDPC1**: Real Gross Domestic Product
- **CPIAUCSL**: Consumer Price Index
- **UNRATE**: Unemployment Rate
- **INDPRO**: Industrial Production
- **FEDFUNDS**: Federal Funds Rate
- **DGS10**: 10-Year Treasury Constant Maturity Rate
- **RSAFS**: Retail Sales
- **PAYEMS**: Total Nonfarm Payrolls
- **PCE**: Personal Consumption Expenditures
- **M2SL**: M2 Money Stock
- **TCU**: Capacity Utilization
- **DEXUSEU**: US/Euro Exchange Rate
## ๐๏ธ Project Structure
```
FRED_ML/
โโโ frontend/ # Streamlit application
โ โโโ app.py # Main application file
โ โโโ fred_api_client.py # FRED API integration
โ โโโ demo_data.py # Demo data generation
โโโ src/ # Core analytics engine
โ โโโ core/ # Core data processing
โ โโโ analysis/ # Analytics modules
โ โโโ visualization/ # Chart generation
โโโ tests/ # Test suite
โโโ requirements.txt # Python dependencies
โโโ Dockerfile # Docker configuration
โโโ README.md # This file
โโโ LICENSE # Apache 2.0 License
```
## ๐งช Testing
### Run All Tests
```bash
python -m pytest tests/
```
### Run Specific Test Categories
```bash
# Test FRED API integration
python -m pytest tests/test_fred_api.py
# Test analytics functionality
python -m pytest tests/test_analytics.py
# Test data processing
python -m pytest tests/test_data_processing.py
```
## ๐ Deployment
### Local Development
```bash
streamlit run frontend/app.py --server.port 8501
```
### Docker Deployment
```bash
docker build -t fred-ml .
docker run -p 8501:8501 -e FRED_API_KEY=your_key_here fred-ml
```
### Hugging Face Spaces
1. Fork this repository
2. Create a new Space on Hugging Face
3. Connect your repository
4. Set environment variables in Space settings
### AWS Deployment
```bash
# Deploy to AWS Lambda
sam build
sam deploy --guided
```
## ๐ค Contributing
We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.
### Development Setup
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests for new functionality
5. Submit a pull request
### Code Style
- Follow PEP 8 guidelines
- Use type hints where appropriate
- Add docstrings to functions
- Include unit tests for new features
## ๐ License
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
## ๐ Acknowledgments
- **Federal Reserve Bank of St. Louis** for providing the FRED API
- **Streamlit** for the excellent web framework
- **Pandas & NumPy** for data processing capabilities
- **Plotly** for interactive visualizations
## ๐ Support
- **Issues**: [GitHub Issues](https://github.com/yourusername/FRED_ML/issues)
- **Discussions**: [GitHub Discussions](https://github.com/yourusername/FRED_ML/discussions)
- **Documentation**: [Wiki](https://github.com/yourusername/FRED_ML/wiki)
## ๐ Links
- **Live Demo**: [FRED ML on Hugging Face](https://huggingface.co/spaces/yourusername/fred-ml)
- **FRED API**: [Federal Reserve Economic Data](https://fred.stlouisfed.org/)
- **Documentation**: [Project Wiki](https://github.com/yourusername/FRED_ML/wiki)
---
**Made with โค๏ธ for economic data enthusiasts**
|