EpexPredictor
Predicts day-ahead electricity prices for various countries in Europe.
https://github.com/b3nn0/epexpredictor
Category: Energy Systems
Sub Category: Energy Markets
Last synced: about 5 hours ago
JSON representation
Repository metadata
Predicts day-ahead electricity prices for various countries in Europe
- Host: GitHub
- URL: https://github.com/b3nn0/epexpredictor
- Owner: b3nn0
- License: bsd-3-clause
- Created: 2025-03-25T14:34:25.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2026-05-30T10:18:25.000Z (21 days ago)
- Last Synced: 2026-06-17T04:03:53.506Z (3 days ago)
- Language: Python
- Homepage:
- Size: 215 KB
- Stars: 74
- Watchers: 10
- Forks: 15
- Open Issues: 1
- Releases: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
README.md
EPEX day-ahead price prediction
This is a simple statistical model to predict EPEX day-ahead prices based on various parameters.
It works to a reasonably good degree. Better than many of the commercial solutions.
This repository includes
- The self-training prediction model itself
- A simple FastAPI app to get a REST API up
- A Docker compose file to have it running wherever
Supported Countries:
- Germany (default)
- Austria
- Belgium
- Netherlands
- Sweden (SE1-SE4)
- Denmark (DK1-DK2)
- Spain
- Portugal
- Others can be added relatively easily, if there is interest
Lookout
- Maybe package it directly as a Home Assistant Add-on
The Model
We sample multiple locations distributed across each region. We fetch Weather data from Open-Meteo.com for those locations for the past n days (default n=120).
This serves as the main data source.
Price data is provided under CC BY 4.0 by smartd.de, retrieved via api.energy-charts.info and ENTSO-E transparency platform.
Grid load data is provided by ENTSO-E transparency platform.
Features
Weather features (per sample location):
- Wind speed at 80m
- Temperature at 2m
- Global tilted irradiance (solar)
- Air pressure at mean sea level
- Relative humidity
Time features:
- Azimuth of the sun as indicator of time of day
- Elevation of the sun
- Day of the week (Monday to Saturday)
- Holiday/Sunday indicator (regional holidays weighted by fraction of regions, e.g. 0.5 if half the regions have the holiday)
- Sunrise influence: how many minutes between sunrise and the current time slot
- Sunset influence: how many minutes between sunset and the current time slot
Other:
- Entso-E load forecast (optional, but highly recommended, especially for DE and AT)
- Natural gas day-ahead-price, forward filled (select regions only)
Output:
- Electricity price
How it works
The model uses LightGBM gradient boosting to predict electricity prices. LightGBM automatically learns non-linear relationships and feature interactions, making it well-suited for electricity price prediction where factors like low wind+solar can cause price spikes due to merit order pricing.
Model performance
For performance testing, see predictor/performance_testing.py.
Remarks:
- Tests were run in 2026, with data from 2025-05-15 to 2026-05-15. The model is tuned for 15 minute pricing. Since data before 2025-10-01 were using hourly pricing, actual performance might be slightly better
- The model uses a 120-day rolling training window
- Tests were done with historical weather data. If the weather forecast is wrong, performance might be slightly worse in practice
Results (1-day ahead prediction):
| Region | MAE (ct/kWh) | RMSE (ct/kWh) |
|---|---|---|
| DE | 1.73 | 2.72 |
| AT | 1.98 | 3.12 |
| BE | 1.83 | 2.75 |
| NL | 1.74 | 2.79 |
| SE1 | 1.63 | 2.79 |
| SE2 | 1.47 | 2.6 |
| SE3 | 1.99 | 2.81 |
| SE4 | 2.34 | 3.22 |
| DK1 | 1.9 | 2.83 |
| DK2 | 2.15 | 3.26 |
| ES | 1.65 | 2.25 |
| PT | 2.07 | 2.76 |
Some observations:
- At night, predictions are typically within 0.5 ct/kWh
- Morning/Evening peaks are typically within 1-1.5 ct/kWh
- Extreme peaks due to "Dunkelflaute" are correctly detected, but estimation of the exact price is a challenge (e.g. the model might predict 75ct while reality is 60ct or vice versa)
- High PV noons are usually correctly detected with good accuracy
Current forecast (DE)
Feel free to generate your own plot for other time ranges or regions here.
Public API
You can find a freely accessible installment of this software here.
Get a glimpse of the current prediction here.
There are no guarantees given whatsoever - it might work for you or not.
I might stop or block this service at any time. Fair use is expected!
Self Hosting
You can easily self-host this software. For easy deployment, check out the docker compose file.
You will probably want to register with Entso-E and request an API key.
Without Entso-E API access
- some parameters are missing and the model will perform significantly worse, especially for DE and AT
- Some regions will not be available (e.g. SE1-4)
Home Assistant integration
At some point, I might create a HA addon to run everything locally.
For now, you have to either use my server, or run it yourself.
Note: Home Assistant only supports a limited amount of data in state attributes. Therefore, we use the "short format" output, and limit the time to 120 hours.
If you need more, you will have to be more creative.
Personally, I provide the data as a HA "service" (now "action") using pyscript, and then call this service to work with the data.
Configuration:
# Make sure you change the parameters region, surcharge and taxPercent according to your electricity plan
sensor:
- platform: rest
resource: "https://epexpredictor.batzill.com/prices_short?region=DE&surcharge=13.70084&taxPercent=19&unit=EUR_PER_KWH&hours=120"
method: GET
unique_id: epex_price_prediction
name: "EPEX Price Prediction"
unit_of_measurement: €/kWh
value_template: "{{ value_json.t[0] }}"
json_attributes:
- s
- t
# If you want to evaluate performance in real time, you can add another sensor like this
# and plot it in the same diagram as the actual prediction sensor
#- platform: rest
# resource: "https://epexpredictor.batzill.com/prices_short?region=DE&surcharge=13.70084&taxPercent=19&evaluation=true&unit=EUR_PER_KWH&hours=120"
# method: GET
# unique_id: epex_price_prediction_evaluation
# name: "EPEX Price Prediction Evaluation"
# unit_of_measurement: €/kWh
# value_template: "{{ value_json.t[0] }}"
# json_attributes:
# - s
# - t
Display, e.g. via Plotly Graph Card:
type: custom:plotly-graph
time_offset: 26h
layout:
yaxis9:
fixedrange: true
visible: false
minallowed: 0
maxallowed: 1
entities:
- entity: sensor.epex_price_prediction
name: EPEX Price Prediction
unit_of_measurement: ct/kWh
texttemplate: "%{y:.0f}"
mode: lines+text
textposition: top right
filters:
- fn: |-
({xs, ys, meta}) => {
return {
xs: xs.concat(meta.s.map(s => s*1000)),
ys: ys.concat(meta.t).map(t => +t*100)
}
}
- entity: ""
name: Now
yaxis: y9
showlegend: false
line:
width: 1
dash: dot
color: orange
x: $ex [Date.now(), Date.now()]
"y":
- 0
- 1
hours_to_show: 30
refresh_interval: 10
evcc integration
evcc is an open-source EV charging controller that can optimize charging based on electricity prices.
It now has native support for EpexPredictor, see docs
Owner metadata
- Name: Adrian Batzill
- Login: b3nn0
- Email:
- Kind: user
- Description:
- Website:
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/1858945?v=4
- Repositories: 4
- Last ynced at: 2023-03-05T07:34:36.512Z
- Profile URL: https://github.com/b3nn0
GitHub Events
Total
- Pull request event: 4
- Fork event: 4
- Issues event: 5
- Watch event: 13
- Issue comment event: 27
- Push event: 95
- Pull request review event: 4
- Pull request review comment event: 6
- Create event: 7
Last Year
- Pull request event: 2
- Fork event: 3
- Issues event: 5
- Watch event: 9
- Issue comment event: 18
- Push event: 52
- Pull request review event: 4
- Pull request review comment event: 6
- Create event: 1
Committers metadata
Last synced: 3 days ago
Total Commits: 186
Total Committers: 5
Avg Commits per committer: 37.2
Development Distribution Score (DDS): 0.118
Commits in past year: 134
Committers in past year: 4
Avg Commits per committer in past year: 33.5
Development Distribution Score (DDS) in past year: 0.142
| Name | Commits | |
|---|---|---|
| Adrian Batzill | d****v@b****m | 164 |
| sokorn | 14 | |
| Gernot Pansy | g****t@p****t | 4 |
| christian mock | cm@t****t | 2 |
| Nikola Ilo | n****o@g****m | 2 |
Committer domains:
- tahina.priv.at: 1
- pansy.at: 1
- batzill.com: 1
Issue and Pull Request metadata
Last synced: 5 days ago
Total issues: 12
Total pull requests: 3
Average time to close issues: 4 days
Average time to close pull requests: about 6 hours
Total issue authors: 9
Total pull request authors: 3
Average comments per issue: 1.75
Average comments per pull request: 2.67
Merged pull request: 1
Bot issues: 0
Bot pull requests: 0
Past year issues: 12
Past year pull requests: 2
Past year average time to close issues: 4 days
Past year average time to close pull requests: 10 minutes
Past year issue authors: 9
Past year pull request authors: 2
Past year average comments per issue: 1.75
Past year average comments per pull request: 1.5
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- cmock (2)
- MarcoPolet (2)
- djfanatix (2)
- avsaase (1)
- Seblin01 (1)
- bash1073 (1)
- gieljnssns (1)
- chk2902 (1)
- HolgerMiara (1)
Top Pull Request Authors
- cmock (1)
- thargor (1)
- seerdekens (1)
Top Issue Labels
Top Pull Request Labels
Dependencies
- python latest build
- flask *
- holidays *
- numpy *
- open_meteo_solar_forecast *
- pandas *
- scikit-learn *
- actions/checkout v4 composite
- docker/build-push-action 0565240e2d4ab88bba5387d719585280857ece09 composite
- docker/login-action 343f7c4344506bcbf9b4de18042ae17996df046d composite
- docker/metadata-action 96383f45573cb7f253c731d3b3ab81c87ef81934 composite
- docker/setup-buildx-action f95db51fddba0c2d1ec667646a06c2ce06100226 composite
- sigstore/cosign-installer 59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 composite
Score: 5.926926025970411