How to calculate and visualize Value at Risk for a Gas & Power portfolio using historical data and the variance-covariance method.
Value at Risk (VaR) answers: “Over a given horizon, what is the maximum loss we might expect at a given confidence level?” For two commodity assets (e.g. Gas and Power), we use historical price data to estimate volatility and correlation, then combine them into a single portfolio VaR. Energy and commodity trading firms use VaR to set position limits, allocate capital, and report risk to regulators and management.
Two common approaches:
In practice, commodity firms combine both: historical simulation for stress views and regulatory capital, and variance-covariance for quick daily VaR and limit checks. Correlation between commodities (e.g. gas and power) is estimated from data and drives how much diversification benefit the portfolio gets.
Distribution assumptions and energy markets
Variance-covariance VaR assumes returns are normally distributed. Energy and commodity price returns often behave differently: they exhibit heavy tails (more extreme moves than the normal distribution implies), skewness (asymmetric upside vs downside, e.g. power spikes vs gradual declines), and jumps (sudden large moves on supply shocks or demand spikes).
That means normal-based VaR can understate tail risk. Extreme events — such as the 2021 Texas freeze (power and gas price spikes) and the 2022 European gas crisis (supply disruption and record volatility) — fall far outside what a Gaussian model would predict.
For that reason, firms pair VaR with stress testing and scenario analysis (e.g. “what if gas triples?” or “pipeline outage”) to capture these tail events; see the section on alternative risk measures below.
Important Formulas
Historical price data feeds log returns; from these we derive daily volatilities and correlation. Those feed the variance-covariance matrix and portfolio VaR (individual and diversified).
Edit the inputs below; calculated fields update automatically. Volatility and correlation are from price data (see sample table below).
| 1. Portfolio inputs | |||
|---|---|---|---|
| Position — Gas (€) | — | ||
| Position — Power (€) | — | ||
| Total portfolio value (€) | 8,000,000 | Position Gas + Position Power | |
| Confidence level (%) | % | 99% confidence means 1% of outcomes are worse than the VaR loss | |
| Holding period (days) | Number of days over which the potential loss is measured; VaR scales with √(days) | ||
| Z-Score | 2.3263 | From confidence level (lookup table) | |
| Weight — Gas | 0.625 | Position Gas / Total | |
| Weight — Power | 0.375 | Position Power / Total | |
| 2. Volatility and correlation | |||
| Daily vol — Gas (from data) | 0.01337 | Std dev of daily log returns (see Important Formulas above) | |
| Daily vol — Power (from data) | 0.01862 | Std dev of daily log returns (see Important Formulas above) | |
| Correlation (from data) | 0.4747 | From price data only (not editable) | |
| 3. Variance-covariance matrix | |||
| Gas | Power | Formula | |
| Gas | 0.000179 | 0.000118 | Variance Gas = (vol Gas) x (vol Gas). Covariance = correlation x (vol Gas x vol Power). |
| Power | 0.000118 | 0.000347 | Same covariance; Variance Power = (vol Power) x (vol Power). |
| 4. Individual VaR (€) | |||
| Gas | 155,503 | Z x (vol Gas) x (sqrt of holding days) x Position Gas | |
| Power | 129,953 | Z x (vol Power) x (sqrt of holding days) x Position Power | |
| 5. Portfolio VaR | |||
| Undiversified VaR (sum, €) | 285,456 | VaR Gas + VaR Power | |
| Portfolio daily volatility | 0.01319 | Square root of (Portfolio variance). Variance = (w Gas x w Gas x var Gas) + (w Power x w Power x var Power) + 2 x (w Gas x w Power x cov). | |
| Diversified portfolio VaR (€) | 245,465 | Z x (Portfolio vol) x (sqrt of holding days) x Total value | |
Distribution of portfolio P&L (€). The shaded tail is the probability of loss exceeding VaR; the vertical line shows VaR at your chosen confidence level.
The core purpose is straightforward: VaR gives traders and risk managers a single number that answers "what's the worst we could lose on a normal day?" It's the common language between the front office, risk desk, and board level.
How it flows through an energy trading firm
At the desk level, each trading desk — power, gas, oil, LNG, emissions — has a VaR limit set by the risk committee. A gas trader with a €5M VaR limit knows they can't build positions that push their 1-day 95% or 99% VaR above that threshold. When they're approaching the limit, they either reduce positions or need explicit approval to exceed it.
The calculator you just built mirrors exactly this: changing position sizes and seeing VaR react in real time is what risk systems like Allegro or Endur do on an intraday basis.
At the portfolio level, the firm aggregates desk-level VaR into an enterprise VaR. This is where correlation and diversification benefit become critical. A firm that's long gas and short power in a correlated market gets a lower portfolio VaR than the sum of individual VaRs.
Risk managers spend significant time debating whether historical correlations will hold — they often break down precisely when you need them most (2021 Texas freeze, 2022 European gas crisis).
Practical applications include:
Where VaR falls short in energy is important to teach:
Alternative risk measures
Beyond VaR, energy trading firms rely on complementary metrics and exercises:
These sit alongside VaR in limit frameworks and capital discussions. For a broader view of market, credit, and operational risk in energy and commodity trading, see Risks in energy & commodity trading. For how hedging and risk management interact, see Hedging explained.
Regulatory angle
Regulatory frameworks require firms to report and manage market risk; VaR is typically the backbone of the risk framework and feeds into capital requirements and position/margin rules.
Returns are ln(P_t / P_{t-1}).
| Day | Gas (€/MWh) | Power (€/MWh) | Gas log return | Power log return |
|---|---|---|---|---|
| 1 | 28.50 | 65.00 | — | — |
| 2 | 28.44 | 64.74 | −0.00210 | −0.00403 |
| 3 | 28.40 | 65.45 | −0.00151 | 0.01093 |
| 4 | 28.35 | 63.75 | −0.00180 | −0.02632 |
| 5 | 28.53 | 63.75 | 0.00646 | −0.00003 |
| 6 | 28.43 | 63.74 | −0.00341 | −0.00005 |
| 7 | 28.57 | 65.19 | 0.00467 | 0.02247 |
| 8 | 28.92 | 65.85 | 0.01224 | 0.01003 |
| 9 | 28.55 | 64.20 | −0.01287 | −0.02537 |
| 10 | 28.69 | 65.83 | 0.00492 | 0.02504 |
| 11 | 28.72 | 65.78 | 0.00125 | −0.00074 |
| 12 | 29.01 | 64.63 | 0.01002 | −0.01768 |
| 13 | 28.87 | 64.96 | −0.00513 | 0.00508 |
| 14 | 29.33 | 65.40 | 0.01609 | 0.00673 |
| 15 | 29.55 | 65.99 | 0.00725 | 0.00907 |
| 16 | 29.98 | 65.40 | 0.01448 | −0.00895 |
| 17 | 30.30 | 64.22 | 0.01067 | −0.01829 |
| 18 | 28.89 | 61.63 | −0.04778 | −0.04108 |
| 19 | 28.42 | 61.91 | −0.01611 | 0.00447 |
| 20 | 28.78 | 61.16 | 0.01238 | −0.01213 |
| 21 | 29.23 | 60.78 | 0.01563 | −0.00631 |
| 22 | 29.20 | 60.45 | −0.00105 | −0.00538 |
| 23 | 29.28 | 61.39 | 0.00255 | 0.01546 |
| 24 | 29.63 | 62.25 | 0.01192 | 0.01378 |
| 25 | 29.99 | 63.25 | 0.01212 | 0.01603 |
| 26 | 29.66 | 62.06 | −0.01084 | −0.01895 |
| 27 | 29.43 | 62.28 | −0.00799 | 0.00340 |
| 28 | 29.31 | 64.56 | −0.00401 | 0.03602 |
| 29 | 28.89 | 62.79 | −0.01435 | −0.02779 |
| 30 | 29.31 | 64.88 | 0.01423 | 0.03277 |