Edwin Salguero
commited on
Commit
Β·
38a6b6a
1
Parent(s):
ebe627d
Security: Move API key to environment variables and update documentation
Browse files- .env.example +1 -0
- README.md +42 -16
- config/settings.py +7 -1
- data/exports/fred_data_20250710_221702.csv +0 -0
- data/exports/fred_data_20250710_223022.csv +0 -0
- data/exports/fred_data_20250710_223149.csv +0 -0
.env.example
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
FRED_API_KEY=your_fred_api_key_here
|
README.md
CHANGED
@@ -20,29 +20,53 @@ pip install -r requirements.txt
|
|
20 |
|
21 |
### 2. API Key Configuration
|
22 |
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
### 3. Project Structure
|
27 |
|
28 |
```
|
29 |
-
|
30 |
-
βββ config
|
31 |
-
βββ
|
32 |
-
|
33 |
-
βββ
|
34 |
-
βββ
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
```
|
37 |
|
38 |
## Usage
|
39 |
|
40 |
### Basic Usage
|
41 |
|
42 |
-
Run the
|
43 |
|
44 |
```bash
|
45 |
-
python
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
```
|
47 |
|
48 |
This will:
|
@@ -53,13 +77,14 @@ This will:
|
|
53 |
|
54 |
### Custom Analysis
|
55 |
|
56 |
-
You can customize the analysis by
|
57 |
|
58 |
```python
|
59 |
-
from
|
|
|
60 |
|
61 |
# Initialize collector
|
62 |
-
collector =
|
63 |
|
64 |
# Custom series and date range
|
65 |
custom_series = ['GDP', 'UNRATE', 'CPIAUCSL']
|
@@ -111,12 +136,13 @@ The tool includes error handling for rate limit issues.
|
|
111 |
|
112 |
## Configuration
|
113 |
|
114 |
-
Edit `config.py` to customize:
|
115 |
-
- API key (if needed)
|
116 |
- Default date ranges
|
117 |
- Output directories
|
118 |
- Default indicators
|
119 |
|
|
|
|
|
120 |
## Dependencies
|
121 |
|
122 |
- `fredapi`: FRED API client
|
|
|
20 |
|
21 |
### 2. API Key Configuration
|
22 |
|
23 |
+
1. Get your FRED API key from [FRED API](https://fred.stlouisfed.org/docs/api/api_key.html)
|
24 |
+
2. Copy `.env.example` to `.env`:
|
25 |
+
```bash
|
26 |
+
cp .env.example .env
|
27 |
+
```
|
28 |
+
3. Edit `.env` and add your API key:
|
29 |
+
```
|
30 |
+
FRED_API_KEY=your_actual_api_key_here
|
31 |
+
```
|
32 |
|
33 |
### 3. Project Structure
|
34 |
|
35 |
```
|
36 |
+
FRED_ML/
|
37 |
+
βββ config/ # Configuration settings
|
38 |
+
β βββ settings.py # Environment variables and settings
|
39 |
+
β βββ pipeline.yaml # Pipeline configuration
|
40 |
+
βββ src/ # Source code
|
41 |
+
β βββ core/ # Core functionality
|
42 |
+
β βββ analysis/ # Analysis modules
|
43 |
+
β βββ utils/ # Utility functions
|
44 |
+
β βββ visualization/ # Visualization modules
|
45 |
+
βββ scripts/ # Executable scripts
|
46 |
+
βββ tests/ # Test files
|
47 |
+
βββ data/ # Data directories
|
48 |
+
β βββ raw/ # Raw data
|
49 |
+
β βββ processed/ # Processed data
|
50 |
+
β βββ exports/ # Exported files
|
51 |
+
βββ requirements.txt # Python dependencies
|
52 |
+
βββ .env.example # Environment variables template
|
53 |
+
βββ README.md # This file
|
54 |
```
|
55 |
|
56 |
## Usage
|
57 |
|
58 |
### Basic Usage
|
59 |
|
60 |
+
Run the EDA script to perform exploratory data analysis:
|
61 |
|
62 |
```bash
|
63 |
+
python scripts/run_eda.py
|
64 |
+
```
|
65 |
+
|
66 |
+
Or run the advanced analytics:
|
67 |
+
|
68 |
+
```bash
|
69 |
+
python scripts/run_advanced_analytics.py
|
70 |
```
|
71 |
|
72 |
This will:
|
|
|
77 |
|
78 |
### Custom Analysis
|
79 |
|
80 |
+
You can customize the analysis by importing the modules:
|
81 |
|
82 |
```python
|
83 |
+
from src.core.fred_client import FREDDataCollectorV2
|
84 |
+
from src.analysis.advanced_analytics import AdvancedAnalytics
|
85 |
|
86 |
# Initialize collector
|
87 |
+
collector = FREDDataCollectorV2()
|
88 |
|
89 |
# Custom series and date range
|
90 |
custom_series = ['GDP', 'UNRATE', 'CPIAUCSL']
|
|
|
136 |
|
137 |
## Configuration
|
138 |
|
139 |
+
Edit `config/settings.py` to customize:
|
|
|
140 |
- Default date ranges
|
141 |
- Output directories
|
142 |
- Default indicators
|
143 |
|
144 |
+
The API key is now managed through environment variables (see Setup section above).
|
145 |
+
|
146 |
## Dependencies
|
147 |
|
148 |
- `fredapi`: FRED API client
|
config/settings.py
CHANGED
@@ -1,5 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# FRED API Configuration
|
2 |
-
FRED_API_KEY = "
|
3 |
|
4 |
# Data settings
|
5 |
DEFAULT_START_DATE = "2010-01-01"
|
|
|
1 |
+
import os
|
2 |
+
from dotenv import load_dotenv
|
3 |
+
|
4 |
+
# Load environment variables from .env file
|
5 |
+
load_dotenv()
|
6 |
+
|
7 |
# FRED API Configuration
|
8 |
+
FRED_API_KEY = os.getenv("FRED_API_KEY")
|
9 |
|
10 |
# Data settings
|
11 |
DEFAULT_START_DATE = "2010-01-01"
|
data/exports/fred_data_20250710_221702.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/exports/fred_data_20250710_223022.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/exports/fred_data_20250710_223149.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|