Dean Shabi
All work

tem. · 2024 to 2025

Pricing energy contracts against the risk of the whole portfolio

I built a modular pricing engine at tem. Analysts swap pricing strategies and test them against simulated markets, with Value at Risk and Expected Shortfall built into every price.

Role
Designed and built the pricing engine
Stack
Python, Monte Carlo, Streamlit
Aerial view of a power station with two chimneys and a switchyard, surrounded by woods and water

How it works

  1. 1

    Contract book

  2. 2

    Market simulation

    Monte Carlo

  3. 3

    Risk metrics

    VaR and ES

  4. 4

    Pricing strategy

  5. 5

    Analyst app

    Streamlit

Every quote is tested in simulated markets alongside the contracts already signed, so the price carries the risk it adds.

Results

What every price accounts for

An illustrative distribution of portfolio losses. VaR marks the loss exceeded only 5% of the time. Expected Shortfall is the average of those worst cases, which is where volatile energy markets hurt.

Small lossesLarge losses

Illustrative shape.

Pricing a tender takes 95% less time, with 10 times as many scenarios tested.

Key decisions

  1. 01

    Price each deal against the whole book

    A new contract changes the risk of everything already signed. The engine simulates the full book with the new contract in it, so the price reflects the risk that contract adds.

  2. 02

    Price in the tail, too

    Value at Risk says how bad a bad month gets. Expected Shortfall says how bad the worst months get. Energy markets have fat tails, so pricing on VaR alone would hide the losses that matter most.

  3. 03

    Two speeds of risk model

    Statistical VaR and ES models give a fast baseline for standard quotes. Monte Carlo runs with thousands of market paths handle contracts that interact in non-linear ways.

  4. 04

    Keep analysts in charge

    A Streamlit app lets analysts swap strategies and compare them side by side. The engine does the maths, and the people who own the price make the call.

Have a machine learning system that has to hold up in production? I'd like to hear about it.