MCPcopy Index your code
hub / github.com/AgriQuantAI/AgriQuant-AI

github.com/AgriQuantAI/AgriQuant-AI @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
254 symbols 721 edges 27 files 216 documented · 85%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

AgriQuant AI

Python License Models Accuracy Markets

AI-driven weather intelligence for agricultural commodity futures.

AgriQuant AI analyzes satellite weather data and 40 years of price patterns to predict agricultural commodity moves 48–72 hours before traditional analysts react. Built on Claude Sonnet, NOAA real-time feeds, and a multi-spectral satellite pipeline covering six global markets.


Overview

AgriQuant AI monitors weather events across six agricultural commodity markets and generates probabilistic price impact signals before official USDA and agency reports are published.

The system processes NOAA weather forecasts, satellite imagery, and market data continuously, cross-referencing against a 40-year historical database of weather-driven commodity price moves.

Backtest Performance (2023–2025): - +223% total return (2.5x leveraged futures strategy) - 70% win rate across 23 trades - 2.6:1 win/loss ratio - 1.8 Sharpe ratio - -21% max drawdown


Markets Covered

Commodity Ticker Exchange Region Primary Risk
Orange Juice FCOJ-A ICE Florida, USA Freeze, hurricane, disease
Coffee (Arabica) KC ICE Minas Gerais, Brazil Frost, drought
Cocoa CC ICE Ghana / Ivory Coast Drought, Harmattan winds
Sugar #11 SB ICE Brazil / India Monsoon, drought
Corn ZC CME US Midwest Drought, derecho, frost
Wheat ZW CME Great Plains Drought, Black Sea risk

System Architecture

┌─────────────────────────────────────────────────────────────┐
│                       AgriQuant AI                          │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  ┌──────────────┐     ┌──────────────┐     ┌────────────┐ │
│  │   Weather    │────▶│    Claude    │────▶│ Database   │ │
│  │  Collector   │     │   Sonnet 4   │     │ PostgreSQL │ │
│  └──────────────┘     └──────────────┘     └────────────┘ │
│        │                     │                     │        │
│  ┌──────────────────────────────────────────────────────┐  │
│  │                 Main Orchestrator                    │  │
│  │  • 15-min monitoring cycle across 6 markets          │  │
│  │  • Prediction generation (8 ML models)               │  │
│  │  • Signal alerts with position sizing                │  │
│  │  • Performance tracking and validation               │  │
│  └──────────────────────────────────────────────────────┘  │
│                                                             │
└─────────────────────────────────────────────────────────────┘

Data Sources:
├── NOAA National Weather Service (free, 15-min)
├── GOES-16 / GOES-18 Satellite Imagery
├── Sentinel-2 (ESA) Multispectral
├── MODIS Vegetation Indices (NDVI)
├── INMET Brazil Weather Stations
├── Ghana Meteorological Agency
├── CME / ICE Futures Tick Data
└── USDA Crop Reports

Key Modules

File Description
weather_collector.py NOAA + satellite data ingestion across all 6 regions
claude_engine.py Claude Sonnet AI analysis pipeline
ensemble_predictor.py 4-model ML ensemble (RF, GB, Ridge, Lasso)
lstm_predictor.py PyTorch LSTM with attention mechanism
backtest.py Historical backtesting engine (2023–2025)
config.py All system parameters + commodity configuration
correlation_analyzer.py Cross-commodity correlation and lead-lag analysis
satellite_data_processor.py NDVI, thermal, moisture flux processing
risk_analyzer.py Position sizing, stop-loss, drawdown management
volatility_forecaster.py GARCH volatility forecasting
market_impact_analyzer.py Price impact modeling
microstructure_analyzer.py Order flow and market microstructure
database.py PostgreSQL data layer
dashboard_api.py FastAPI transparency endpoints
main.py Main orchestrator
demo.py Demo mode with sample data

Signal Rules

LONG Signals: - NOAA freeze watch/warning in production zone - Hurricane forecast cone intersects commodity region - Sustained warm/wet conditions exceeding disease-outbreak thresholds - Drought index crossing critical threshold (coffee, cocoa, sugar)

SHORT Signals: - Freeze warning cancelled or storm diverts - Above-average rainfall ends drought - Crop condition upgrades in USDA weekly reports

Risk Management: - Max 5% portfolio per signal - 2% stop-loss per position - Max hold: 21 days - Average hold time: 4.7 days


Quick Start

# Install dependencies
pip install -r requirements.txt

# Set environment variables
export ANTHROPIC_API_KEY=your-key
export NOAA_API_KEY=your-key        # optional
export PLANET_API_KEY=your-key      # optional
export DATABASE_URL=postgresql://localhost/agriquant

# Run demo (no live data required)
python demo.py

# Run full system
python main.py

Backtesting

python backtest.py --start 2023-01-01 --end 2025-12-31 --leverage 2.5

Output includes equity curve, per-trade log, Sharpe ratio, max drawdown, and comparison vs. S&P 500 and buy-and-hold futures.


What Worked / What Didn't

What worked: - Freeze warnings with 48+ hour lead time: 75% win rate - Hurricane path divergence shorts: 85% win rate - Quick exits after weather event resolves

What didn't: - Trading preliminary model runs (>72 hours out): too early, too noisy - Holding through USDA report releases: usually priced in by then - Trading minor cold fronts (<28°F): insufficient crop impact


Disclaimer

Backtested performance uses historical data with 2.5x leverage. Assumes perfect fills, no slippage, and hindsight signal construction. Leverage amplifies both gains and losses. Past performance does not guarantee future results. This is not financial advice.


Links

Core symbols most depended-on inside this repo

predict
called by 8
lstm_predictor.py
analyze_freeze_event
called by 6
claude_engine.py
shutdown
called by 4
main.py
calculate_liquidity_metrics
called by 3
microstructure_analyzer.py
connect
called by 2
database.py
fit_garch_11
called by 2
volatility_forecaster.py
fetch_usda_crop_progress
called by 2
icco_usda_scraper.py
get_state_forecast
called by 2
grains_collector.py

Shape

Method 196
Class 32
Function 18
Route 8

Languages

Python100%

Modules by API surface

database.py18 symbols
satellite_data_processor.py16 symbols
lstm_predictor.py16 symbols
dashboard_api.py16 symbols
risk_analyzer.py15 symbols
main.py14 symbols
backtest.py12 symbols
volatility_forecaster.py11 symbols
performance_tracker.py10 symbols
microstructure_analyzer.py10 symbols
investor_distribution.py10 symbols
coffee_brazil_collector.py10 symbols

Datastores touched

agriquantDatabase · 1 repos

For agents

$ claude mcp add AgriQuant-AI \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact