← Projects · Data science · Energy markets

Forecasting Brent crude from geopolitics, sanctions and market data

Can what is known at today's close (recent price action, volatility, geopolitical risk, Iran sanctions, OPEC supply) predict where Brent goes over the next 1 or 5 trading days? We built a point-in-time dataset of 35 years and tested 52 models under strict, leakage-resistant chronological validation, then scored the frozen choice once on 2020–2025.

MKMohammad Amin Khoshkam IAIman Alimohammadi SYSadra Yeganeh

joint project · all three members contributed equally

Course: Data Science, Sharif University of Technology Instructor: Dr. Salavati Term: Summer 2026 Stack: Python, pandas, scikit-learn, Jupyter
BRENTEurope spot · USD/bbl –
weekly candles · last – updownkey event
real EIA Brent spot series (RBRTE) · candles built from daily closes · hover for OHLC and events
9,214daysdaily observations, 1990–2025
44inputspoint-in-time predictors
52modelsconfigurations from 12 families
1,382test daysuntouched, 2020–2025
+3.7%skillbest 5-day MAE gain over a no-change forecast
99%prob.bootstrap support for the 5-day gain
STEP01
Phase 1 · cleaning and alignment

Oil prices meet geopolitics

The project joins five tables into one daily master table: Brent, WTI and Dubai prices, a curated timeline of 68 market-moving geopolitical events, 25 US/EU/UN sanctions on Iran, Iran's crude exports by destination, and monthly risk indicators (Geopolitical Risk Index, VIX, dollar index, OPEC spare capacity, Strait of Hormuz closure probability).

Events and sanctions are moved to the next trading day when they fall on a weekend, and every lower-frequency series is lagged by its reporting delay: monthly indicators by one month, annual export data by one year. Nothing enters a row before it would have been public.

The source market series are synthetic but calibrated to historical levels, as their author states, and they contain long flat stretches at artificial price ceilings. Instead of deleting them, we flag every row whose features or target touch a ceiling. That gives two training populations: all rows (the complete history) and eligible rows (about 72% of days, with clean targets).

NoteBecause the price paths are synthetic, the project is an educational benchmark of a sound forecasting workflow, not a trading strategy. The candlestick chart at the top shows the real EIA Brent series for context.

Dataset

Period
2 Jan 1990 – 25 Apr 2025
Trading days
9,214
Eligible rows (1-day / 5-day)
6,633 / 6,613
Geopolitical events
68 (25 involve Iran)
Sanctions
25 (1979–2025)

Targets

1-day Brent return
σ ≈ 1.8–2.0%
5-day Brent return
σ ≈ 4.8–5.2%
Largest 1-day move
−26.0% / +16.6%

Sources

Market and events
Kaggle, Apache 2.0
Real Brent spot
U.S. EIA
STEP02
Phase 2 · feature engineering

44 predictors, all known at the close

From 124 candidate columns, administrative fields, raw price levels, unlagged indicators and near-duplicates (|Spearman ρ| ≥ 0.90) were removed. The remaining 44 predictors fall into seven groups:

Return lags6

Brent returns 1, 2, 3, 5, 10 and 20 days back

Rolling return statistics11

mean, volatility, average absolute move and share of up-days over 5–60 days

Momentum and trend6

5–60-day momentum, distance from the 5- and 60-day moving averages

Geopolitical risk8

GPR index, Iran-specific risk, Hormuz closure probability and risk premium, event pulse

Sanctions5

days since the last sanction, oil/financial sector hit, relief flag, pressure step

Macro and supply5

VIX, dollar index, OPEC production and spare capacity, US rig count

Calendar3

day of week, month-end flag, seasonal month term

target: yt,h = 100 · (Brentt+h / Brentt − 1),  h ∈ {1, 5}  ·  every feature on row t uses data up to Brentt only

STEP03
Phase 3 · model selection

Leakage-resistant chronological validation

No shuffling, ever. Each experiment uses four expanding validation blocks followed by a final, untouched 15% test. A training row is admitted only if its full h-day target was already observed when the evaluation block starts (record_id + h ≤ origin), so overlapping 5-day targets cannot leak across the boundary.

Twelve model families, one rulebook

Every candidate receives the same 44 inputs and the same folds: recency-weighted Ridge, Elastic Net, robust Huber SGD, linear and RBF SVR, distance-weighted KNN, Random Forest, Extra Trees, AdaBoost, Gradient Boosting, Histogram Gradient Boosting and a four-layer MLP, alongside zero-return and training-median baselines. The family with the lowest pooled validation MAE is frozen, then its walk-forward refit cadence (every 5, 20, 60 or 252 days, or never) is tuned on the same folds.

  • Lags use shift(k ≥ 1); rolling windows use returns up to day t only
  • Imputation and scaling fitted inside each training fold
  • Monthly / annual indicators lagged by their publication delay
  • Future-window and administrative flags never used as inputs
  • Family, settings and cadence frozen before the single test run
STEP04
Out-of-sample test · 2020–2025

How accurate were the forecasts?

Short-horizon oil returns are notoriously hard to predict, so the fair yardstick is a no-change (zero-return) forecast, which is what an efficient market implies. The test period includes the 2020 COVID crash, the 2022 Ukraine shock and the 2023–2025 Middle East escalation.

selected model–
test MAE–
skill vs no-change–
direction hit rate–
90% band coverage–
test days–

Forecast vs realised 5-day Brent return

bars: realised return · gold line: forecast · teal band: 90% volatility-scaled prediction band (hover for values)

realised uprealised downforecast90% band

Simulated price path: forecast vs actual Brent

each point turns a forecast made at the origin into a price, Pt·(1 + ŷ), and compares it with the price actually reached 5-day later. Most of the close fit comes from prices moving little relative to their level; the skill numbers above measure what the model adds.

actual Brent in the project dataset (synthetic, calibrated)model-implied pricegaps: excluded price-ceiling periods

Forecast vs outcome

every test day; dots in the shaded quadrants called the direction correctly · dashed: perfect forecast

Validation leaderboard

best configuration of each family vs the zero-return forecast · gold: selected model

ExperimentSelected modelTest MAENo-change MAESkill vs no-changeSkill vs persistenceDirectionR²
All rows · 1-dayRidge, refit 51.6251.641+1.0%+27.7%46.6%0.023
Eligible · 1-dayExtra Trees, refit 201.8701.922+2.7%+29.7%52.0%0.031
All rows · 5-dayRidge, refit 54.1434.278+3.2%+18.4%51.2%0.069
Eligible · 5-dayRidge, refit 204.8685.058+3.7%+16.1%57.6%0.054

MAE in percentage points of return. “Persistence” repeats the most recently completed return over the same horizon. Direction: share of days where the forecast had the right sign.

ReadingAll four frozen models beat the no-change forecast out of sample, by 1–4% in MAE, and cut the error of a naive persistence forecast by 16–30%. The gains are small, as they should be for a liquid market. The 5-day models carry the clearest signal: a Spearman correlation of about 0.23 with the outcome, and the eligible 5-day model is the only one whose hit rate (57.6%) beats always guessing the majority direction (55.7%).
STEP05
Is the edge real?

Bootstrap tests and prediction bands

Forecast errors on neighbouring days are correlated, especially for overlapping 5-day targets, so a plain bootstrap would be overconfident. We resample 20-day blocks of the test errors 5,000 times and ask how often the model beats the no-change forecast.

ExperimentMAE gain (pp)95% CIP(gain > 0)
All rows · 1-day0.017[−0.002, 0.041]95.2%
Eligible · 1-day0.052[−0.002, 0.130]97.0%
All rows · 5-day0.135[0.016, 0.281]99.0%
Eligible · 5-day0.190[0.034, 0.378]99.3%

At the 5-day horizon the gain is statistically supported: both intervals exclude zero. At one day the evidence is borderline. Comparing the two training populations on identical test days gives no decisive winner, since both paired intervals cross zero.

90% prediction bands

All rows · 1-day
85.0% · ±2.7 pp
Eligible · 1-day
89.8% · ±3.6 pp
All rows · 5-day
84.0% · ±6.7 pp
Eligible · 5-day
88.3% · ±8.9 pp

coverage on the test set · median half-width. Bands scale with recent 20-day volatility, using the 90th percentile of normalised validation errors.

What did not work

Deep MLP
weakest family everywhere
Flexible boosting
loses to zero in validation
Best performers
heavily shrunk Ridge
EXT06
Phase 4 · extension on real EIA Brent

The direction is a coin toss, the risk is not

Returns behave almost like a random walk, but volatility clusters: turbulent weeks tend to follow turbulent weeks. The extension applies the same point-in-time protocol to the real EIA Brent series (1987–2026). It forecasts realised volatility over the next 5 and 22 trading days with eight models (historical mean, naive, EWMA, GARCH(1,1), HAR, log-HAR, HAR-X Ridge, gradient boosting). The choice is made on pre-2020 data and tested once on 2020–2026, a period in which Brent spot fell to $9.12 and moved up to 64% in a single day.

+15.6%skill5-day volatility forecast vs the historical average, out of sample
100%prob.bootstrap support for that gain (95% CI 0.09–0.29 pp)
0.21–0.37R²5-day volatility: selected model to best HAR-type model on the test
≈ 0R²real Brent returns: still unpredictable with the same features
test 2020–2026 · log scale · hover for values

Realised vs forecast volatility of real Brent

white: realised volatility (% per day) · gold: validation-selected model · dashed: historical average

realisedforecast: –historical average
Model (test 2020–2026)MAER²Skill vs historical meanSkill vs naive

Gold row: the model chosen on pre-2020 validation. All models are shown for transparency; none was re-chosen after seeing the test.

ReadingThe 5-day volatility forecast holds up out of sample and beats the historical average with a statistically supported gain. At 22 days the narrow validation winner (EWMA) adapted too slowly after the 2020 crash and fell behind. HAR-type regressions were the most stable family across horizons and periods. Geopolitical-event dates added no consistent information beyond recent volatility.
ALLΣ
Summary

What we learned

  • Timing discipline matters more than model choice. With every feature strictly point-in-time and a purged split, the honest edge over a no-change forecast is a few percent, not the near-perfect fits that leakage would produce.
  • Simple beats complex here. Strongly regularised, recency-weighted Ridge regression was selected in three of four experiments; deep and boosted models mostly learned noise.
  • Longer horizons are easier. Five-day returns carry a small but statistically supported signal; daily returns are close to a random walk.
  • Risk is forecastable even when direction is not. On real Brent, a 5-day volatility model beats the historical average by 15.6% out of sample, while return forecasts stay at the no-change benchmark.
  • Report uncertainty, not just a number. Block-bootstrap intervals and volatility-scaled bands (84–90% coverage for a 90% target) show how far a single forecast can be trusted.