Commodity Trading with Weather Data
Weather-integrated algorithmic trading strategy for coffee markets — backtested Sep 2023 – Aug 2024
Personal
Problem
Problem
Commodity prices for agricultural goods like coffee are significantly affected by weather events in key growing regions. Standard technical analysis ignores this signal entirely. The hypothesis: integrating weather anomaly indicators from Brazil (the world's largest coffee producer) with traditional technical signals produces better-timed trade entries and exits than technical analysis alone.
Approach
Approach
Weather data from Visual Crossing (hourly, aggregated to daily) was aligned with historical coffee price data. Feature engineering produced frost event indicators (< 0°C), drought conditions (rainfall < 10mm/7d), extreme rainfall (> 20mm), and 7-day rolling averages for temperature, humidity, and wind speed. These were combined with technical indicators (Bollinger Bands, MACD, RSI, ATR, VWAP, Keltner Channels, CCI). Three strategies were backtested and compared: pure technical, weather-integrated signal selection, and weather-based position sizing.
Architecture
Architecture
Commodity Trading with Weather Data — system diagram
Key Technical Decisions
Key Technical Decisions
Focus on Brazil weather specifically
Brazil produces ~35% of world coffee supply. Frost events in Minas Gerais historically cause supply shocks that spike futures prices within days. Limiting weather signals to the primary production region produced more signal-to-noise than aggregating global weather.
Three distinct strategy variants
Testing a pure technical baseline against weather-integrated signal selection and weather-based position sizing allows isolation of the weather signal's contribution. The comparison showed weather integration improved timing precision rather than return magnitude.
Results
Results
- ✓Weather-integrated strategies outperformed pure technical analysis on timing precision
- ✓Frost and drought indicators provided leading signals ahead of supply-shock price moves
- ✓Backtested across Sep 2023 – Aug 2024 with leverage, stop-loss, and take-profit mechanics
- ✓Seasonal trend analysis confirmed cyclical patterns in Brazilian growing regions
Tech Stack
Tech Stack
Links
Links