CoolFace
Apppublic

reaumur777/economic_monitor

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes
App README

Economic Monitor

A comprehensive economic dashboard tracking 170+ indicators across monetary policy, inflation, labor markets, credit conditions, equity markets, commodities, and currencies.

Architecture

LayerTechnologyPurpose
FrontendStreamlit (HF Spaces)Interactive dashboard
DatabaseSupabase (Postgres)Time series storage
DataFRED API + Yahoo FinanceEconomic & market data
CodeGitHubVersion control, HF Spaces sync

Setup

1. Supabase

  1. 1.Create a new Supabase project called "Economic Monitor"
  2. 2.Go to SQL Editor and run the contents of supabase_setup.sql
  3. 3.Create a user in Authentication → Users for dashboard login
  4. 4.Copy your Project URL and service role key from Settings → API

2. Environment Variables

For local fetch scripts, create a .env file (never commit this):

SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your-service-role-key
FRED_API_KEY=your-fred-api-key

Or set in your shell:

bash
export SUPABASE_URL=https://your-project.supabase.co
export SUPABASE_KEY=your-service-role-key
export FRED_API_KEY=your-fred-api-key

For Hugging Face Spaces, set these in your Space Settings → Secrets:

  • —SUPABASE_URL
  • —SUPABASE_KEY ← use the anon key here (read-only, RLS protected)

3. Initial Data Fetch

bash
# Install dependencies
pip install -r requirements.txt

# Fetch all data (takes ~5-10 minutes on first run)
python main_supabase.py fetch

# Fetch specific source
python main_supabase.py fetch --source fred
python main_supabase.py fetch --source yahoo

# Fetch only high-priority tiers
python main_supabase.py fetch --tiers 1 2

# Check status
python main_supabase.py status

4. Daily Fetch (Morning Routine)

Run each morning to keep data current:

bash
python main_supabase.py fetch

Or add to crontab (runs at 7am):

0 7 * * * cd /path/to/economic_monitor && python main_supabase.py fetch

5. Deploy to Hugging Face Spaces

  1. 1.Push this repo to GitHub
  2. 2.Create a new HF Space:
  3. 3.SDK: Streamlit
  4. 4.Link your GitHub repo
  5. 5.Add secrets in Space settings (SUPABASEURL, SUPABASEKEY)
  6. 6.HF Spaces will auto-deploy on every push to main

Dashboard Tabs

TabContents
OverviewKey metrics, equity snapshot, tier 1-2 indicator table
MarketsUS & global equities, sectors, volatility
Rates & CreditYield curve, credit spreads, Fed policy, stress indices
EconomyInflation, employment, GDP, housing, surveys
Commodities & FXMetals, energy, agriculture, currencies
CompareCustom multi-indicator comparison with stats table

File Structure

economic_monitor/
├── app.py                  # Streamlit dashboard (HF Spaces entry point)
├── main_supabase.py        # CLI for local data fetching
├── database_supabase.py    # Supabase database manager
├── processors.py           # Data transforms & analytics (unchanged)
├── fred.py                 # FRED API collector (unchanged)
├── yahoo.py                # Yahoo Finance collector (unchanged)
├── supabase_setup.sql      # Run once in Supabase SQL Editor
├── requirements.txt        # Python dependencies
├── config/
│   ├── indicators.yaml     # All 170+ indicator definitions
│   └── api_keys.yaml       # Local API keys (not committed)
└── README.md

Notes

  • —The service role key is for local fetch scripts only (has write access)
  • —The anon key is for HF Spaces (read-only, protected by RLS)
  • —Supabase Row Level Security ensures only authenticated users can view data
  • —Data is cached for 5 minutes in the dashboard (@st.cache_data(ttl=300))
  • —First fetch of full history since 2000 takes ~5-10 minutes