WeDeAn – Weather Derivatives Analyzer
WeDeAn (Weather Derivatives Analyzer) is a Python and Streamlit-based application for analyzing weather data and valuing HDD/CDD-based weather derivatives. It integrates DWD (Deutscher Wetterdienst) datasets, computes degree-day indices, and applies burn analysis to estimate the theoretical payoffs and actuarial fair values of weather options.
The source code is available on GitHub.
Features
-
Load and process DWD weather datasets: reads and cleans station data (TMK, RSK, SDK, and others) and prepares it for analysis.
-
Calculate heating and cooling degree days: converts daily mean temperatures (TMK) into HDDs and CDDs, the indices underlying temperature derivatives.
-
Adjust for climatic trends: optionally detrends long-term HDD/CDD series to remove warming or cooling bias.
-
Burn analysis pricing: computes historical payoffs and fair values of HDD/CDD options from actually observed weather.
-
Interactive visualizations: time series plots, rolling averages, payoff curves, and fair value results, all within a single Streamlit dashboard.
The process at a glance
- Load the dataset – select a weather station and import its historical data (TMK, SDK, RSK, and so on).
- Clean and filter – restrict the data to the chosen observation window (
Observation length) and drop years with incomplete records. - Compute the degree-day indices – aggregate daily HDDs and CDDs into seasonal accumulated values.
- Trend adjustment (optional) – remove long-term temperature trends.
- Calculate the payoffs – compute the option payoff for each season from the accumulated indices.
- Price the options (burn analysis) – estimate the fair value as the discounted historical mean of those payoffs.
Core concepts
HDDs (heating degree days)
A measure of how much and for how long the outside air temperature is below a base temperature (commonly 18°C). They are used to estimate heating demand: colder weather means higher HDDs and greater energy use.
Formula:
HDD_i = max(0, T_base - T_i)
Here T_i is the daily mean temperature, and the seasonal index is the sum of the daily HDDs over the contract season.
CDDs (cooling degree days)
A measure of how much and for how long the outside air temperature is above a base temperature (commonly 18°C). They are used to estimate cooling demand: hotter weather means higher CDDs and more electricity use.
Formula:
CDD_i = max(0, T_i - T_base)
As with HDDs, T_i is the daily mean temperature and the daily values are summed over the contract season.
Fair value of HDD/CDD options
The expected (average) payout, discounted to present value. It can be estimated by:
- Historical simulation (burn analysis)
- Statistical modeling
- Monte Carlo simulation
Pricing by burn analysis
A transparent pricing method based on historical weather records.
- Compute the HDD/CDD index for each historical year.
- Calculate the option payoff (e.g., call/put) for each burn year.
- Take the average discounted payoff across all years as the fair value.
Assumption: the historical temperature distribution is representative of the future.
Run the application
1. Clone the repository
git clone https://github.com/trholy/wedean.git
cd wedean
2. Build and run the Docker container
docker compose up --build
3. Open it in your browser
The app is served at http://localhost:8501.
Example output
- Berlin Marzahn 2020
- CDDs
- Trend adjusted
- Observation length: 12 years
- Moving average length: 5 years
- Interest rate: 2.0%
- Tick size: $100

Project structure
├── .dockerignore
├── .gitignore
├── Dockerfile
├── LICENSE
├── README.md
├── datasets
├── docker-compose.yml
├── pyproject.toml
├── setup.py
├── src
│ ├── __init__.py
│ ├── wedean
│ │ ├── calculation
│ │ │ ├── __init__.py
│ │ │ └── calculation.py
│ │ ├── data_handling
│ │ │ ├── __init__.py
│ │ │ └── data_handling.py
│ │ ├── plotting
│ │ │ ├── __init__.py
│ │ │ └── plotting.py
│ │ └── utils
│ │ ├── __init__.py
│ │ └── utils.py
└── streamlit-app
├── app.py
├── requirements.txt
└── utils.py
License
This project is released under the MIT License. You are free to use, modify, and distribute it, with attribution.