Get the forward/futures curve for a commodity from Yahoo Finance – the historical daily closing price of each dated futures contract over the next contracts calendar months (e.g. Crude Oil’s December 2026, January 2027, … contracts), rather than a single flat continuous/spot price.

This is what a Schwartz-Smith (2000) two-factor commodity price model needs to back out the convenience-yield term structure under the risk-neutral (Q) measure – the curve’s shape (contango or backwardation) at each point in time is exactly what a single spot price series cannot reveal.

Not every commodity has a listed contract for every calendar month (grains in particular only trade specific delivery months), so months with no listed contract are silently skipped – the number of columns returned can be fewer than contracts.

Also known as: futures term structure, forward curve.

No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Commodity Forward Curve for you. Just ask in plain English.

Calculate the Commodity Forward Curve in Python

The Commodity Forward Curve is available in the Economics module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_commodity_forward_curve as shown below.

from financetoolkit import Economics

economics = Economics(start_date='2026-01-01', end_date='2026-08-01')

economics.get_commodity_forward_curve("Crude Oil", contracts=6)

Which returns:

Date 2026-09 2026-10 2026-11 2026-12 2027-01
2026-07-27 82.61 80.25 78.17 76.53 75.31
2026-07-28 79.26 77.17 75.33 73.85 72.74
2026-07-29 84.46 82.04 79.68 77.74 76.28
2026-07-30 83.59 80.8 78.19 76.12 74.65
2026-07-31 84.67 81.49 78.65 76.44 74.88

Parameters

get_commodity_forward_curve accepts the following parameters:

  • commodity (str): The commodity to retrieve the curve for. One of “Crude Oil”, “Natural Gas”, “Gold”, “Silver”, “Copper”, “Corn”, “Wheat” or “Soybeans”.
  • contracts (int, optional): The number of sequential monthly contracts ahead of today to attempt to fetch. Defaults to 12.
  • rounding (int | None, optional): The number of decimals to round the results to. Defaults to None.

The Economics module page introduces the module, and the sidebar lists all of its functions.

Share