EUR/USD Forecasting with Central Bank Sentiment
A time-series machine learning pipeline that tests whether public sentiment about the two main central banks, the European Central Bank (ECB) and the US Federal Reserve, helps forecast the EUR/USD exchange rate.
Problem
Central bank decisions move currencies, and markets react to expectations before decisions are announced. If public sentiment about the ECB and the Fed shifts before the exchange rate does, it could work as a leading indicator. Testing this honestly is harder than it looks: daily exchange rates are strongly autocorrelated, so almost any model that uses yesterday's rate looks accurate. The real question is whether sentiment adds anything beyond that.
Approach
Data. I combined several years of daily EUR/USD prices with 3.6 million tweets (13 GB) about the ECB and the Fed, including tweets tied to the tenures of ECB presidents Jean-Claude Trichet, Mario Draghi and Christine Lagarde, collected with snscrape driven by shell scripts.
Features. The raw text was converted into daily sentiment indexes for each central bank, and then into rolling time-series features (e.g., 15-day lags) to capture shifts in sentiment before they reach the price.
Modeling. I compared models from linear regression to random forests and gradient boosting, using time-series cross-validation (backtesting splits) so models are always evaluated on data later than the data they were trained on. Every model was compared against a random-walk baseline: tomorrow's rate equals today's rate.
Results
- Adding sentiment features gave a small improvement over the random-walk baseline
- R² on rate levels went from ≈ 0.997 (baseline) to ≈ 0.999 (with sentiment). Both are high because daily exchange rates are strongly autocorrelated, which is why the comparison against the random walk, not the R² itself, is the meaningful test
- A reproducible pipeline in five notebooks, from scraping to evaluation, with the scraped data included
Solution Overview
EUR/USD daily prices 3.6M tweets on ECB & Fed (snscrape)
│ │
│ Daily sentiment indexes (EUR, USD)
│ │
└──────── Joined table + rolling features (e.g., 15-day lags)
│
Time-series CV (backtesting): linear → random forest → gradient boosting
│
Comparison against random-walk baseline
Tech Stack
- Python, Bash, Jupyter
- Pandas, NumPy, scikit-learn
- snscrape
- Matplotlib, Seaborn
-
Let's have a virtual coffee together!
Want to see if we're a match? Let's have a chat and find out. Schedule a free 30-minute session to discuss your data challenges and explore how we can work together.