Iberian electricity market · 2021–2026
Spanish power price forecasts two to seven days ahead, valued in euros for a flexible load. Along the way, a look-ahead leak in the grid operator's public data, and a reinforcement-learning agent that did not beat a plain optimiser.
of the possible saving with the forecasts built here. Tomorrow's price alone: 7%.
Flexible load · 109 weeks · load factor 0.30
Value → 23%of the apparent gain from the operator's wind and solar forecasts was look-ahead.
Day-ahead · 730 days · p = 0.0014
Data trap → 0 of 9reinforcement-learning designs beat the forecast-driven optimiser. Exploratory
57 weeks the agents never trained on
RL →01 · MarketMidday power got cheap. Evenings did not.
OMIE day-ahead price · Spain · Jun 2021 – Oct 2026
The shape of a day, month by month
Average price for each hour of the day, €/MWh, Spanish bidding zone, local time.
One month of Spanish power prices, hour by hour. This is April 2022.
Now wrap the day round a clock: midnight at the top, noon at the bottom. The further from the centre, the dearer the hour.
Each mark is one hour of one month. April 2026 joins April 2022: at midday its marks fall to the dashed ring, which is zero.
Every month since June 2021, one colour per year. Midday has sunk; the evening has not.
Every month on one clock, and one clock for each year.
One clock for each year
Average price for each hour of the day, by month, €/MWh. Select a year to highlight it on the large clock.
The average midday price fell from 144.2 €/MWh in 2021 (June to December) to 20.8 €/MWh in 2026 (January to October). The gap between evening and midday grew from 29 to 107 €/MWh. In 2026, 925 hours so far have been at or below zero, 749 of them negative.
That gap is where batteries, flexible loads and hybrid plants earn their money. But only if someone can see it coming.
Spain is no longer the mild case
Spain against six other European bidding zones, January to October 2026.
Of these seven zones, Spain had the most negative-price hours in January to October 2026: 749, with France next at 571. Its evening-minus-midday gap, 107 €/MWh, sits within the other six zones' range of 99 to 114.
Midday and evening prices, and hours below zero
Seven day-ahead bidding zones, 1 Jan – 23 Oct 2026. Average price at midday and in the evening, €/MWh, and number of hours with a negative price.
02 · ValueA better forecast is worth money, and you can measure how much.
A flexible load of up to 1 MW · 109 weeks, 16 Sep 2024 – 18 Oct 2026
Picture an industrial process that can shift its consumption, such as a mill that fills a silo or a pump that fills a reservoir. It must use a fixed amount of energy each week. Every day at 14:00 it decides how much to use tomorrow, in tomorrow's cheapest hours, and leaves the rest for days it only knows through forecasts.
Tomorrow's price is already known by then: the day-ahead auction closes at midday and prices appear around 13:00. Every later day is a forecast.
Same optimiser, different forecast
The optimiser is always the same. Only the forecast changes. Every strategy uses the cheapest hours of each day; they differ in how much energy they leave for later days. An even daily split, the same energy every day, scores 0%. Perfect foresight scores 100%.
Share of the possible saving captured
Same optimiser, different forecasts. 0% = even daily split, 100% = perfect foresight.
An even daily split is the baseline: 0%. At load factor 0.30 it costs 32.17 €/MWh; perfect foresight would cost 23.49.
Knowing tomorrow's price only captures 7% of the saving. Tomorrow's cheap hours are not enough when the rest of the week is unknown.
A simple regression on past prices reaches 53%.
Planning with the futures market reaches 63%.
Planning with the LightGBM forecasts reaches 77%. It is 1.24 €/MWh cheaper than the futures plan, though it still lost in 35 of the 109 weeks.
How much a longer forecast is worth depends on how much energy has to move. The load factor is the share of the 1 MW maximum the load uses over the week.
With a light load (0.15), tomorrow's price alone captures 58%: tomorrow's cheapest hours already cover much of the week.
At 0.30, knowing only tomorrow's price captures 7% and planning with the LightGBM forecasts 77%.
With a heavy load (0.50), knowing only tomorrow's price does worse than an even daily split: −14%. Most of the energy has to go to days that only a forecast can see.
Plan a week yourself
Pick a week and a load. You will see the real price, the plan each strategy makes, and what the week cost.
Illustrative
What if it were a battery?
The same change in the market can be read as revenue. With perfect foresight, a 1 MW / 2 MWh battery doing one daily cycle on the Spanish day-ahead market could have earned up to 40,153 €/MW in 2022 and 53,956 €/MW in 2025. 2026 is already at 61,803 €/MW by late October.
How much of that does a forecast capture? Planning each day with the LightGBM forecast made two days ahead captured 95.4% (95% interval 93.8–96.8%). Simply reusing yesterday's prices captured 91.5% (88.0–94.2%). With a single daily cycle the shape of the day is very regular, so a good forecast adds little here. A load that has to plan a whole week, as above, is where forecasting beyond tomorrow pays.
With 80% or 90% round-trip efficiency instead of 85%, the 2025 value is 49,715 or 58,198 €/MW, and the capture rates barely move. The model cycles almost every day, about 365 full cycles a year, well above the 100 to 300 that Fraunhofer ISE assumes1, because it has no degradation cost. That is one more reason to read these figures as an upper bound.
Daily day-ahead arbitrage with perfect foresight
€ per MW of a 1 MW / 2 MWh battery, by year. 2021 and 2026 are partial years.
1 Fraunhofer ISE, Stromgestehungskosten erneuerbare Energien, 2024, Table 2. PDF ↩
03 · ForecastWeather data pays off beyond tomorrow.
Test period 13 Sep 2024 – 22 Oct 2026 · weekly recalibration
Most published work forecasts the next day. Planning a week needs D+2 to D+7, where the grid operator's wind and solar forecasts stop. The forecasts here use only public data already published by 14:00 on the decision day.
Adding weather forecasts cuts the error by 12.4% to 30.0% from D+2 to D+7: from between 18.1 and 28.8 €/MWh to between 14.0 and 25.2. The grid operator's own forecasts matter most for the next day and help little after that.
Forecast error with and without weather forecasts
Mean absolute error of LightGBM, €/MWh, by forecast horizon. Lower is better. Both lines use recent prices, grid operator forecasts, and fuel and CO2 prices; one also uses weather forecasts. The final model adds further data.
Much of the error a week out is the weather forecast's own error: with observed weather instead, the D+7 error would fall by a further 23.5%.
04 · Data trapA public archive inflated a forecast's value.
Grid operator's wind and solar forecasts · Red Eléctrica e·sios · D+1 · 730 days
The grid operator publishes wind and solar forecasts, and its public archive keeps a later revision, not the version that existed when the day-ahead market closed.
With the archived version, those forecasts seemed to improve a day-ahead price model by 10.4%; with the version really available at noon, by 7.9%. So 23% of the apparent gain was look-ahead. Beyond the day ahead, the operator's forecasts did not help either version.
Ask which version a data feed keeps in week one of an integration.
05 · Reinforcement learningReinforcement learning did not beat a plain optimiser.
Second year · 57 weeks the agents never trained on · 15 Sep 2025 – 18 Oct 2026
A PPO agent was trained on the first year of forecasts and tuned on ten held-out weeks, where it matched the optimiser: 14.67 against 14.73 €/MWh.
In the year it had not trained on, it broke down. It cost more than the optimiser in 11 of 12 cases, 8 of them significant. With the LightGBM forecasts it cost 30.22 €/MWh against 21.89.
Extra cost compared with perfect foresight, cumulative
Euros for a flexible load of up to 1 MW. Lower is better.
With a light load (0.15), the original agent still cost more than the optimiser, and the best redesign tied with it.
At load factor 0.30, the original agent paid about 28,700 € more than perfect foresight over the 57 weeks; the optimiser with LightGBM, about 4,800 €.
With a heavy load (0.50), the original agent ended the year costlier than an even daily split, as at 0.30. The best redesign tied with the optimiser.
Almost all of that loss came in the most expensive third of weeks: 10.47 €/MWh, against 0.36 and 0.35 in the others. The expensive season had flipped. Winter was dear and summer cheap in the first year; in the second, the reverse. Six weeks of the second year were dearer than any week of the first. The agent had never seen prices like that. The optimiser does not need to.
Eight redesigns followed. None of the nine designs, all using the LightGBM forecasts, beat the optimiser at any load factor. The best one lets the agent weight the forecasts and leaves the decision to the optimiser; it tied, at 0.14 to 0.26 €/MWh more, not significant.
If learning is used at all, let it feed the optimiser, not replace it.
06 · PlatformWhat this means for a flexibility platform.
From one flexible load to a fleet
This study looks at one flexible load in Spain, not at a fleet of batteries. A platform that trades and dispatches batteries, renewables and hybrid plants faces the same four questions.
-
Value a forecast by the decision it changes
A lower error is not always worth more money. In the futures-based plan here, a better D+2 forecast was worth 0.61 €/MWh and a better D+7 forecast 0.02 €/MWh, not distinguishable from zero. The plan is revised every day, so distant days rarely change today's decision. Spend the effort on the horizons dispatch actually uses.
Value -
Know what was known, and when
Store every input with the time it was published, and check which version a data feed keeps. Ask in week one of an integration, not in month six.
Data trap -
Beyond tomorrow, integrate weather first
Beyond tomorrow, weather forecasts matter most; futures help clearly only at D+4 and D+5; fuel prices, calendar and system variables gave no significant gain at any horizon. Measure an integration before paying for it.
Forecast -
Keep dispatch explainable
No reinforcement-learning design here beat a plain optimiser fed with good forecasts, and the original agent lost most in the most expensive weeks, some dearer than any it had trained on. A linear optimiser can be audited, re-run every few minutes and explained to a client. Exploratory
Reinforcement learning
07 · Sources and creditsEvery number is traced to its source.
Every figure on this page comes from the result files of an MSc thesis or, for the battery box and the country comparison, from a new analysis on public data, recomputed by the build script in this page's repository. The thesis is in progress and its result files are not public yet. Savings are simulated on past data, not earned in a market, and the evaluation is retrospective: the test period had been examined before the final forecasting runs and before the reinforcement-learning redesigns were chosen.
Data
OMIE day-ahead market results (data to 23 Oct 2026). Red Eléctrica e·sios, used for information and non-commercial purposes (data to 23 Oct 2026). Weather: NOAA GFS; contains modified Copernicus Climate Change Service information (ERA5). Prices outside Spain: Energy-Charts (Fraunhofer ISE), data Bundesnetzagentur | SMARD.de, CC BY 4.0, retrieved 22 Nov 2026. Futures prices (OMIP) are used in the models but not reproduced here.
Made by
- Research, analysis, design and code
- Isabel Lasierra · LinkedIn
- Thesis
- MSc in Data Science, Universitat Oberta de Catalunya (UOC), in progress, 2026
- Built with
- Python (pandas, LightGBM, scikit-learn, Gymnasium, Stable-Baselines3) and D3. Page updated 22 Nov 2026.