Commodity Features
Overview
When renewable generation is insufficient to meet demand, gas-fired combined cycle plants are typically the marginal price-setting technology in Spain. The cost of gas generation — driven by fuel and carbon permit costs — sets a floor for electricity prices during these periods. Commodity features capture this cost structure.
Raw Commodity Inputs
| Variable | Source | Unit | Update Frequency | Used in Model |
|---|---|---|---|---|
| TTF Natural Gas | yfinance (TTF=F) | EUR/MWh | Daily (forward-filled weekends) | Yes (via derived features) |
| Brent Crude Oil | yfinance (BZ=F) | USD/bbl | Daily (forward-filled weekends) | No (display only) |
| EU ETS Carbon | yfinance (CO2.L) | EUR/tonne CO₂ | Daily (forward-filled weekends) | Yes (via derived features) |
Gas and carbon are transformed into model features (see below). Oil prices are not used directly in forecasting models but are displayed on the Price Drivers dashboard as a leading indicator — oil price shocks transmit to gas markets within 1–3 days via fuel substitution and linked supply contracts.
All three prices are forward-filled across weekends and holidays since commodity markets close on non-trading days.
Derived Features
Marginal Cost of Gas Generation
marginal_cost_gas = gas_price × 1.9 + carbon_price × 0.37This proxy estimates the short-run marginal cost of a combined cycle gas turbine (CCGT):
- 1.9 factor: Heat rate conversion — a modern CCGT needs ~1.9 MWh of gas to produce 1 MWh of electricity (~53% efficiency)
- 0.37 factor: CO₂ emission intensity — a CCGT emits ~0.37 tonnes CO₂ per MWh of gas burned
When gas costs 30 EUR/MWh and carbon costs 60 EUR/tonne:
marginal_cost = 30 × 1.9 + 60 × 0.37 = 57.0 + 22.2 = 79.2 EUR/MWhThis represents the price floor during gas-marginal hours.
Spark Spread
spark_spread = price_lag_24h - marginal_cost_gasThe spark spread measures the profitability of gas generation at yesterday’s prices:
- Positive spark spread: Gas plants are profitable, likely to run → prices supported near marginal cost
- Negative spark spread: Gas plants are unprofitable, likely to shut down → prices below cost, usually due to high renewables
- Large positive spread: Prices well above gas cost, suggesting demand-driven scarcity or other factors
Gas × Residual Demand Interaction
gas_x_residual_demand = gas_price × residual_demandThis interaction captures the conditional relationship: gas prices matter most when residual demand is high (meaning gas plants must run). When residual demand is low (abundant renewables), gas prices are irrelevant because gas plants aren’t dispatched.
Why Commodities Matter
Spanish electricity prices are set by merit-order dispatch: generators are activated from cheapest to most expensive until supply meets demand. The merit order roughly follows:
1. Renewables (near-zero cost) → Price effect: suppresses2. Nuclear (low marginal cost) → Price effect: baseload floor3. Hydro (opportunity cost) → Price effect: moderate4. Combined cycle gas (fuel + CO₂) → Price effect: often marginal5. Coal (highest, being phased out) → Price effect: price ceilingDuring hours when renewables + nuclear + hydro can’t cover demand, gas plants set the price. Their marginal cost directly determines the electricity price.
Feature Importance
In feature importance rankings, commodity features typically appear:
- Top 3 during low-renewable periods (winter evenings, calm days)
- Below top 10 during high-renewable periods (sunny/windy afternoons)
marginal_cost_gasis consistently more important than raw gas or carbon prices alone, confirming the value of the derived feature
Data Handling
Weekend Gap Filling
Commodity markets close Friday evening and reopen Monday morning. Friday’s closing prices are forward-filled through Saturday and Sunday. This is standard practice — market conditions rarely change enough over a weekend to materially affect the cost estimate.
Missing Data
If commodity data is unavailable for an extended period, the pipeline uses the most recent available values. Commodity prices change slowly relative to electricity prices (daily vs hourly), so short gaps have minimal forecasting impact.