GRID is a systematic trading intelligence platform that ingests macroeconomic and market data from 37+ global sources, resolves multi-source conflicts using [[PIT Store|point-in-time]] (PIT) correct methodology, engineers features, discovers market regimes via unsupervised clustering, validates hypotheses through [[Walk-Forward Backtesting|walk-forward backtesting]], and maintains an immutable [[Decision Journal|decision journal]]. Every query enforces strict no-lookahead constraints to prevent data leakage.
DISTINCT ON, MAKE_INTERVAL, array types, and partial indexes). [[TimescaleDB]] extension optional but recommended. Provided via Docker.cd grid
# 1. Configure
cp .env.example .env
# Edit .env — set FRED_API_KEY and GRID_MASTER_PASSWORD_HASH
# 2. Start database
docker compose up -d
# 3. Install Python deps + apply schema
pip install -r requirements.txt
python db.py
# 4. Build PWA
cd pwa && npm install && npm run build && cd ..
# 5. Start API server
python -m uvicorn api.main:app --host 0.0.0.0 --port 8000
The API serves the PWA at / and the REST API at /api/v1/*.
# Database
docker compose up -d # Start PostgreSQL + TimescaleDB
python db.py # Apply schema
# Backend
pip install -r requirements.txt
python -m uvicorn api.main:app --reload --port 8000 # Dev server
# Frontend
cd pwa && npm install && npm run dev # Dev server on :5173
cd pwa && npm run build # Production build
# Tests
python -m pytest tests/ -v # Full suite (354 tests)
python -m pytest tests/test_pit.py -v # PIT store tests (critical)
python -m pytest tests/test_integration_pipeline.py -v # Pipeline integration
# Data ingestion
python -m ingestion.scheduler --historical # Historical pull (1990+)
python -m ingestion.scheduler # Ongoing scheduler
# Discovery
python -m discovery.orthogonality # Orthogonality audit
python -m discovery.clustering # Regime clustering
# LLM insights
python -m outputs.insight_scanner --days 7 # Review accumulated LLM outputs
See docs/architecture.md for detailed diagrams covering:
DATA SOURCES (37+) NORMALIZATION PIT STORE FEATURES
┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ FRED, BLS │─────▶│ Conflict │───▶│ No-lookahead │───▶│ z-score │
│ ECB, BOJ │ │ Resolution │ │ FIRST_RELEASE│ │ slope, ratio │
│ yFinance │ │ Per-family │ │ LATEST_AS_OF │ │ pct_change │
│ 30+ more │ │ thresholds │ │ DISTINCT ON │ │ spread │
└──────────────┘ └──────────────┘ └──────────────┘ └──────┬───────┘
│
┌──────────────────────────────────────────────────┘
│
▼
DISCOVERY INFERENCE JOURNAL LLM LAYER
┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ PCA, GMM │ │ Production │───▶│ Immutable │ │ Ollama │
│ Correlation │ │ model score │ │ decisions │ │ Hyperspace │
│ k=2..6 test │ │ BUY/SELL/ │ │ Outcomes │ │ TradingAgents│
│ 100x options │ │ HOLD │ │ Annotations │ │ Briefings │
└──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘
[[FRED]], [[BLS]], Census, Treasury, BEA, yFinance, Reddit sentiment, options chains
[[ECB]], BOJ, BOE, RBI, KOSIS (Korea), AKShare (China), MAS (Singapore), ABS (Australia), BCB (Brazil), Eurostat, OECD, BIS, DBnomics, IMF
UN Comtrade v2, CEPII BACI, Harvard Atlas ECI, WIOD
[[NOAA]] AIS, [[EIA]], [[USDA]] NASS, NASA VIIRS, EU KLEMS, USPTO PatentsView, OFR, Opportunity Insights, [[GDELT]]
See docs/api-reference.md for complete endpoint documentation.
Key endpoints:
| Endpoint | Description |
|---|---|
GET /api/v1/system/health | Health check (no auth) |
POST /api/v1/auth/login | Authenticate |
GET /api/v1/regime/current | Current regime state |
GET /api/v1/signals/current | Live trading signals |
GET /api/v1/journal | Decision journal entries |
POST /api/v1/agents/run | Trigger TradingAgents deliberation |
POST /api/v1/ollama/briefing | Generate market briefing |
WS /ws | Real-time updates (regime, signals, agent progress) |
GRID uses local LLM inference via [[Ollama]], [[Hyperspace]] (P2P), or [[llama.cpp]]. All LLM calls:
None if the provider is offline (graceful degradation)outputs/llm_insights/Orchestrates analyst agents (fundamental, technical, sentiment, news), a bull/bear debate, risk assessment, and produces a BUY/SELL/HOLD decision logged to both agent_runs table and the immutable [[Decision Journal|decision journal]].
[[Ollama]] generates hourly, daily, and weekly market condition reports saved to outputs/market_briefings/.
Hypothesis generation, economic mechanism explanation, backtest critique, and regime transition analysis — used by the discovery and validation pipelines.
GRID's signal logic is never sent to external networks. All LLM calls use local inference only. [[Hyperspace]] embeddings use public economic concepts, never raw feature values or cluster structures.
CANDIDATE → SHADOW → STAGING → PRODUCTION → FLAGGED → RETIRED
354 tests across 27 test files:
python -m pytest tests/ -v # Full suite
python -m pytest tests/test_pit.py -v # PIT correctness (highest priority)
python -m pytest tests/test_gates.py -v # Promotion gate logic
python -m pytest tests/test_registry.py -v # Model lifecycle state machine
Tests run without [[PostgreSQL]] (mocked). PIT tests verify no future data leaks.
See docs/deployment.md for production deployment guide covering:
See docs/development.md for developer guide covering:
See ATTENTION.md for the 64-item audit tracking list with current status.
| Category | Status |
|---|---|
| Security (SQL injection, auth, secrets) | Fixed |
| Data integrity (PIT, conflicts, NaN) | Fixed |
| Test coverage | 354 tests, all critical modules covered |
| LLM output logging | All outputs logged to timestamped files |
| Production readiness | Documented, critical items addressed |
grid/
├── api/ # FastAPI routes, auth, middleware (14 routers)
├── ingestion/ # 37+ data source pullers (domestic, intl, alt, physical)
├── normalization/ # Multi-source conflict resolution
├── store/ # PIT-correct query engine (PostgreSQL DISTINCT ON)
├── features/ # Feature engineering (z-score, slopes, ratios)
├── discovery/ # Unsupervised regime clustering + options scanner
├── validation/ # Walk-forward backtesting gates
├── inference/ # Live model scoring
├── journal/ # Immutable decision log
├── governance/ # Model lifecycle state machine
├── agents/ # TradingAgents multi-agent framework
├── hyperspace/ # Local LLM inference layer (P2P)
├── ollama/ # Ollama integration + market briefings
├── llamacpp/ # llama.cpp direct integration
├── outputs/ # LLM insight logging + scanner
├── physics/ # Market physics verification
├── workflows/ # Declarative workflow system
├── server_log/ # Git-backed error logging + operator inbox
├── pwa/ # React 18 PWA frontend (Zustand, Vite)
├── tests/ # pytest suite (354 tests)
├── docs/ # Architecture, API, deployment, development guides
└── scripts/ # Migration and utility scripts
Python
79.4%
JavaScript
17.2%
Jupyter Notebook
1.3%
GRID is a systematic trading intelligence platform that ingests macroeconomic and market data from 37+ global sources, resolves multi-source conflicts using [[PIT Store|point-in-time]] (PIT) correct methodology, engineers features, discovers market regimes via unsupervised clustering, validates hypotheses through [[Walk-Forward Backtesting|walk-forward backtesting]], and maintains an immutable [[Decision Journal|decision journal]]. Every query enforces strict no-lookahead constraints to prevent data leakage.
DISTINCT ON, MAKE_INTERVAL, array types, and partial indexes). [[TimescaleDB]] extension optional but recommended. Provided via Docker.cd grid
# 1. Configure
cp .env.example .env
# Edit .env — set FRED_API_KEY and GRID_MASTER_PASSWORD_HASH
# 2. Start database
docker compose up -d
# 3. Install Python deps + apply schema
pip install -r requirements.txt
python db.py
# 4. Build PWA
cd pwa && npm install && npm run build && cd ..
# 5. Start API server
python -m uvicorn api.main:app --host 0.0.0.0 --port 8000
The API serves the PWA at / and the REST API at /api/v1/*.
# Database
docker compose up -d # Start PostgreSQL + TimescaleDB
python db.py # Apply schema
# Backend
pip install -r requirements.txt
python -m uvicorn api.main:app --reload --port 8000 # Dev server
# Frontend
cd pwa && npm install && npm run dev # Dev server on :5173
cd pwa && npm run build # Production build
# Tests
python -m pytest tests/ -v # Full suite (354 tests)
python -m pytest tests/test_pit.py -v # PIT store tests (critical)
python -m pytest tests/test_integration_pipeline.py -v # Pipeline integration
# Data ingestion
python -m ingestion.scheduler --historical # Historical pull (1990+)
python -m ingestion.scheduler # Ongoing scheduler
# Discovery
python -m discovery.orthogonality # Orthogonality audit
python -m discovery.clustering # Regime clustering
# LLM insights
python -m outputs.insight_scanner --days 7 # Review accumulated LLM outputs
See docs/architecture.md for detailed diagrams covering:
DATA SOURCES (37+) NORMALIZATION PIT STORE FEATURES
┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ FRED, BLS │─────▶│ Conflict │───▶│ No-lookahead │───▶│ z-score │
│ ECB, BOJ │ │ Resolution │ │ FIRST_RELEASE│ │ slope, ratio │
│ yFinance │ │ Per-family │ │ LATEST_AS_OF │ │ pct_change │
│ 30+ more │ │ thresholds │ │ DISTINCT ON │ │ spread │
└──────────────┘ └──────────────┘ └──────────────┘ └──────┬───────┘
│
┌──────────────────────────────────────────────────┘
│
▼
DISCOVERY INFERENCE JOURNAL LLM LAYER
┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ PCA, GMM │ │ Production │───▶│ Immutable │ │ Ollama │
│ Correlation │ │ model score │ │ decisions │ │ Hyperspace │
│ k=2..6 test │ │ BUY/SELL/ │ │ Outcomes │ │ TradingAgents│
│ 100x options │ │ HOLD │ │ Annotations │ │ Briefings │
└──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘
[[FRED]], [[BLS]], Census, Treasury, BEA, yFinance, Reddit sentiment, options chains
[[ECB]], BOJ, BOE, RBI, KOSIS (Korea), AKShare (China), MAS (Singapore), ABS (Australia), BCB (Brazil), Eurostat, OECD, BIS, DBnomics, IMF
UN Comtrade v2, CEPII BACI, Harvard Atlas ECI, WIOD
[[NOAA]] AIS, [[EIA]], [[USDA]] NASS, NASA VIIRS, EU KLEMS, USPTO PatentsView, OFR, Opportunity Insights, [[GDELT]]
See docs/api-reference.md for complete endpoint documentation.
Key endpoints:
| Endpoint | Description |
|---|---|
GET /api/v1/system/health | Health check (no auth) |
POST /api/v1/auth/login | Authenticate |
GET /api/v1/regime/current | Current regime state |
GET /api/v1/signals/current | Live trading signals |
GET /api/v1/journal | Decision journal entries |
POST /api/v1/agents/run | Trigger TradingAgents deliberation |
POST /api/v1/ollama/briefing | Generate market briefing |
WS /ws | Real-time updates (regime, signals, agent progress) |
GRID uses local LLM inference via [[Ollama]], [[Hyperspace]] (P2P), or [[llama.cpp]]. All LLM calls:
None if the provider is offline (graceful degradation)outputs/llm_insights/Orchestrates analyst agents (fundamental, technical, sentiment, news), a bull/bear debate, risk assessment, and produces a BUY/SELL/HOLD decision logged to both agent_runs table and the immutable [[Decision Journal|decision journal]].
[[Ollama]] generates hourly, daily, and weekly market condition reports saved to outputs/market_briefings/.
Hypothesis generation, economic mechanism explanation, backtest critique, and regime transition analysis — used by the discovery and validation pipelines.
GRID's signal logic is never sent to external networks. All LLM calls use local inference only. [[Hyperspace]] embeddings use public economic concepts, never raw feature values or cluster structures.
CANDIDATE → SHADOW → STAGING → PRODUCTION → FLAGGED → RETIRED
354 tests across 27 test files:
python -m pytest tests/ -v # Full suite
python -m pytest tests/test_pit.py -v # PIT correctness (highest priority)
python -m pytest tests/test_gates.py -v # Promotion gate logic
python -m pytest tests/test_registry.py -v # Model lifecycle state machine
Tests run without [[PostgreSQL]] (mocked). PIT tests verify no future data leaks.
See docs/deployment.md for production deployment guide covering:
See docs/development.md for developer guide covering:
See ATTENTION.md for the 64-item audit tracking list with current status.
| Category | Status |
|---|---|
| Security (SQL injection, auth, secrets) | Fixed |
| Data integrity (PIT, conflicts, NaN) | Fixed |
| Test coverage | 354 tests, all critical modules covered |
| LLM output logging | All outputs logged to timestamped files |
| Production readiness | Documented, critical items addressed |
grid/
├── api/ # FastAPI routes, auth, middleware (14 routers)
├── ingestion/ # 37+ data source pullers (domestic, intl, alt, physical)
├── normalization/ # Multi-source conflict resolution
├── store/ # PIT-correct query engine (PostgreSQL DISTINCT ON)
├── features/ # Feature engineering (z-score, slopes, ratios)
├── discovery/ # Unsupervised regime clustering + options scanner
├── validation/ # Walk-forward backtesting gates
├── inference/ # Live model scoring
├── journal/ # Immutable decision log
├── governance/ # Model lifecycle state machine
├── agents/ # TradingAgents multi-agent framework
├── hyperspace/ # Local LLM inference layer (P2P)
├── ollama/ # Ollama integration + market briefings
├── llamacpp/ # llama.cpp direct integration
├── outputs/ # LLM insight logging + scanner
├── physics/ # Market physics verification
├── workflows/ # Declarative workflow system
├── server_log/ # Git-backed error logging + operator inbox
├── pwa/ # React 18 PWA frontend (Zustand, Vite)
├── tests/ # pytest suite (354 tests)
├── docs/ # Architecture, API, deployment, development guides
└── scripts/ # Migration and utility scripts
Python
79.4%
JavaScript
17.2%
Jupyter Notebook
1.3%