Skip to content

salmansoltaniyan/algo-electricity-trading

 
 

Repository files navigation

Algorithmic Trading on German Electricity Markets

Project Overview

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.

Motivation

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.

Instructions

Clone the repository:

git clone https://github.com/anthonymakarewicz/algo-electricity-trading.git electricity_trading
cd electricity_trading

Usage

1. Exploratory Data Analysis (EDA)

Notebook: 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


2. Data Processing

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


3. Feature Engineering & Selection

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)


4. Model Evaluation

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.

About

Intraday algorithmic trading on the German electricity market

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Jupyter Notebook 99.9%
  • Python 0.1%