Commodity Prices
Natural gas, oil, and carbon emission prices are key drivers of electricity prices because they determine the marginal cost of thermal generation — the price-setting technology during periods of high demand or low renewable output.
All three commodities are collected via yfinance (Yahoo Finance market data).
TTF Natural Gas
What it is: The Title Transfer Facility (TTF) is the European benchmark for natural gas trading, quoted in EUR/MWh.
Why it matters: Combined cycle gas turbines (CCGTs) are the marginal price-setting generators in Spain during high-demand hours. Gas prices directly influence their operating costs and, through the merit order, the wholesale electricity price.
Ticker: TTF=F (ICE Dutch TTF Natural Gas Futures), fallback NG=F (Henry Hub)
Brent Crude Oil
What it is: ICE Brent Crude Oil Futures, the international benchmark for oil prices, quoted in USD per barrel.
Why it matters: Oil price shocks transmit to natural gas markets within 1–3 days because of fuel substitution and linked supply contracts. Rising oil prices pull gas prices up, which in turn increases the marginal cost of gas-fired electricity generation. This transmission chain (oil → gas → electricity) makes oil a leading indicator of electricity price movements.
Ticker: BZ=F (ICE Brent Crude Futures), fallback CL=F (WTI Crude)
EU ETS Carbon
What it is: European Union Emission Trading System allowance prices, quoted in EUR per tonne of CO2.
Why it matters: Thermal generators must purchase carbon allowances proportional to their emissions. Higher carbon prices increase the cost of coal and gas generation, pushing electricity prices up.
Ticker: CO2.L (SparkChange Physical Carbon EUA ETC, LSE), fallback KRBN (KraneShares Carbon ETF)
Data Handling
Weekend and Holiday Gaps
Commodity markets don’t trade every day. Weekends, public holidays, and settlement delays create gaps in the daily data. EPF forward-fills these gaps — the last known price is carried forward until a new trading day provides an update.
Storage
Commodity prices are stored in the commodity_daily table with columns:
date(primary key)ttf_gas_eur_mwh— Natural gas price (EUR/MWh)brent_oil_usd_bbl— Brent crude oil price (USD/bbl)ets_carbon_eur— Carbon allowance price (EUR/tCO2)collected_at— Ingestion timestamp
Commodity-Derived Features
Raw commodity prices are transformed into economically meaningful features:
Marginal Cost Proxy
marginal_cost_gas = gas_price × 1.9 + carbon_price × 0.37Where:
- 1.9 is the heat rate (MWh of gas per MWh of electricity for a typical CCGT)
- 0.37 is the carbon intensity (tonnes CO2 per MWh of electricity)
This approximates the variable cost of running a gas power plant.
Spark Spread
spark_spread = yesterday_electricity_price - marginal_cost_gasA positive spark spread means gas generation is profitable. When negative, gas plants may not run, reducing supply and potentially increasing prices.
Gas-Residual Demand Interaction
gas_x_residual_demand = gas_price × residual_demandThis captures the compound effect: gas prices matter most when thermal generation is actually needed (high residual demand after renewables and nuclear). When renewables cover most demand, gas prices have less influence on the electricity price.