Skip to content
Labs · 04Energy data

Cheap electricity runs on a schedule.

Spain’s regulated tariff re-prices every hour, and solar has turned the old advice upside down: the cheap hours are no longer at night — they are at lunchtime. I took two years of official prices and asked one domestic question: if you ran the washing machine by a fixed rule that fits on a post-it, how much would you lose against checking the tariff every single day? Answer: 2.62 € a year — except in winter, and the when-it-fails is published right here next to the wins.

PVPC hourly · backtest year362 days · Sep 2025 → Aug 2026 · dark = cheap
00h06h12h18h23hSep 25Oct 25Nov 25Dec 25Jan 26Feb 26Mar 26Apr 26May 26Jun 26Jul 26Aug 26
59230€/MWh00h06h12h18h23hthe cheap onethe rule
24 Nov 2025
weekday
rule: 1416h · 12.1 c€/kWh
best: 0406h · 6.0 c€/kWh
the rule paid +102% that day
tap any column above · arrow keys work too
Six ways to pick a window · one honest scoreboardextra cost vs. perfect information
small ridge regression (calendar + yesterday's shape)+6% · 1.65 €/yrthe rule — hourly average by day type+10% · 2.62 €/yrpersistence (yesterday's cheap hours)+18% · 4.72 €/yrfixed midday, 1–3 PM+42% · 10.72 €/yrfixed pre-dawn, 2–4 AM (folk wisdom)+73% · 18.76 €/yrany random hour+97% · 24.82 €/yr0% = checking the published tariff every evening · washing machine, 1 kWh per daily 2h cycleTHE RULE, MONTH BY MONTHJan +28%no sun, no solar valley — winter iswhere the rule loses its footing

Every column above is a real day; it opens on the rule’s worst one. Each contender picks tomorrow’s two-hour window seeing only data up to yesterday — the backtest engine verifies that nothing leaks from the future, and a deliberately cheating rule exists in the test suite to prove the check bites.

2.62 €

what a year of daily two-hour washes costs above perfect information if you follow the fixed table and never look at a tariff again — 10.2% of regret

+28%

the rule's regret in January alone. When the sun hides, cheap hours drift back to pre-dawn while the rule keeps aiming at midday — winter is where it fails, and we say so

24.82 €

the worst you can possibly do: plugging in at a random hour every day for a year. The absolute stakes are tiny — that honesty is the point of the exercise

The work4 scripts · Python
01
Download

Two years of hourly PVPC from Red Eléctrica's open API, month by month, no token required. Idempotent: a second run touches nothing.

24 requests · 17,448 hours
02
Assemble

One row per hour, validated against reality before anything else runs: no silent gaps, the 23- and 25-hour clock-change days accounted for by name, prices inside physical bounds.

invariants abort loudly
03
Backtest

Five rules and two anchors pick tomorrow's window seeing only the past. The engine hands each rule a view object that physically cannot contain the future.

leak-proof by construction
04
Export

Everything this page shows — 727 days of prices, every verdict, every failure — is one static JSON file. No backend, no live API, nothing to break.

159 KB · cutoff Aug 28, 2026
What this is — and isn’t

This is a personal learning project built on open data, frozen at a stated cutoff — the page does not query anything live. Tomorrow’s PVPC is published every evening around 20:15, so no forecasting is being pretended here: the interesting question is how far a fixed rule gets without looking at all, and the answer is “within 2.62€/year, except in winter”.

Honest fine print: PVPC is the regulated tariff — free-market contracts price differently. The rule knows the calendar but not the weather. National holidays only. The PVPC formula itself has been phasing in futures since 2024, which shifts the ground under any long backtest. And a small ridge regression does beat the post-it rule (6.4% vs 10.2% regret) — the tidy story would hide that; this one doesn’t. Prices never went negative in these two years: grid fees put a floor under the wholesale market’s wildest days.

Code on GitHub·Read the write-up·Labs · 01·Labs · 02