This project leverages ensemble tree based machine learning models to predict the direction of the spread (imbalance vs. day-ahead prices) in the German Electricity Market, with the goal of maximizing cumulative Profit & Loss (P&L).
The dataset consists of 15-minute interval observations with the primary features being:
- Wind generation forecasts - Impact supply variability from renewable sources.
- Solar generation forecasts - Capture solar energy’s contribution to the electricity grid.
- Load (demand) forecasts - Reflect consumer demand patterns that influence electricity prices.
The spread reflects the dynamics of electricity supply and demand:
- When supply exceeds demand, imbalance prices tend to decrease to account for the excess.
- When demand surpasses supply, imbalance prices generally increase.
By modeling these relationships, the project aims to develop a systematic trading strategy to exploit these price differences.
Clone the repository:
git clone https://github.com/anthonymakarewicz/algo-electricity-trading.git electricity_trading
cd electricity_tradingNotebook: eda.ipynb
- Performs an in-depth analysis of the dataset:
- Analysis over several frequencies (Daily, Weekly, Monthly)
- Outlier Detection using Boxplots
- Seasonality analysis using line plot and Autocorrelation Function
Notebook: data_processing.ipynb
- Handles outliers using winsorization and hampel filter.
- Compares and applies several transformations techniques:
- Log Transformation
- Box-Cox Transformation
- Yeo-Johnson Transformation
Notebook: feature_engineering_selection.ipynb
-
Generate new features to extract relevent information including:
- Time/Dates features
- Cyclical features
- Interaction effects
- Rolling features
-
Leverage various feature selection techniques to remove irrelevent features including:
- Correlation Filter
- Recursive Feature Elimination (RFE)
- Embedded Methods (Random Forest Feature Importance)
Notebook: model_evaluation.ipynb
- Trains and evaluates ensemble models for spread prediction such as:
- XGBoost
- LightGBM
- Random Forest
- Perform hyperparameter tuning using Grid Search to avoid overfitting
- Compares models using cumulative profit & loss (P&L) curves.



