Commodity Futures Curves Visualisation – “The Movie”

March 18, 2010

My current project needs a good visualisation of various commodity futures curves and their evolution over time. I’ve seen dozens of ‘Snapshots in time’ pictures in various sources, but I knew there was a better way. Some coding in Matlab has enabled me to observe the futures curves evolving in time, rendered as a movie.

Below are some samples, for the period 2004-2009. The lefthand figure is the futures curve, the righthand figure is the price history of the front-most contract (usually as close as we get to ‘spot’ price). Linear interpolation has been used if some months are not traded.

Please comment if you can’t view the movies (Apple people, can you see them?) or want other commodities.

NOTE : Download the movies for much better quality.

Energy Commodities

WTI Crude Oil, ‘CL’ 2004-2010 (download, 28Mb) / 1985-2005 (download, 100Mb)

Nymex Natural Gas, ‘NG’ (download movie, 27Mb)

Metals

Copper, High Grade, ‘HG’. (download movie, 28Mb)

Agriculturals

Wheat, #2 Soft Soft Red Winter, ‘W’. (download movie, 28Mb)

Cocoa, LIFFE (download movie, 29Mb)

Advertisements

Recommended Paper – Commodities Futures Curves

March 15, 2010

A paper (PDF) written back in 1991 by Jacques Gabillon is an excellent introduction to futures curves. He describes the general features of futures curves and specifically those in the oil market, such as the typical ways they change over time, the concepts of ‘backwardation’ and ‘contango’, and the term structure of volatility. He compares the futures curve with the term structure of interest rates.

He then goes on to examine simple models for oil prices using a single SDE (stochastic differential equation) to describe the short-term movements, and clearly explains the role of convenience yield and why cannot be a constant in time and across all maturities. He gradually adds necessary features to a simple oil model to captures more and more empirically observed features of the futures curve. This culminates in his proposed 2-factor model, now known as the Gabillon Model, having both the short term and (unobserved) long term price of oil represented as an (arithmetic) Brownian Motion.

As well as an excellent introduction to his own model, Gabillon’s paper (freely available here (PDF), no login required) is a great introduction to futures curves. It is as relevant today as when it was written, and the principles apply to all commodities, not just oil.

Reference:

Gabillon, J. 1991. The term structures of oil futures prices. Working Paper. Oxford Institute for Energy Studies. www.oxfordenergy.org/pdfs/WPM17.pdf


Commodity Futures Curve Interpolation – Parallel Matlab

March 7, 2010

Matlab 2010a has been recently released, and finally the student version has the Parallel Computing Toolbox available for purchase as an option. I’ve been waiting to play with this for several years.

I document in the PDF below my initial experiments with the toolbox. Specifically, I look into a simple, parallelizable task, that of interpolating commodity futures curves, when we often want to interpolate many days’ curves. Each can be processed independently of the others.

I document a basic way of parallelising this algorithm in Matlab, what kind of speedups to expect using the ‘parfor’ syntax, and the risk of significant slowdown if care is not taken.

I also manage to make the software completely backwards compatible, so it can be shared with those who don’t have the parallel computing toolbox.

Finally, I show a way of making intelligent libraries. For small sized problems, they will execute in serial, because the parallel method imposes big overheads. For larger problem sizes, they will switch to parallel mode.

The PDF includes all the nececessary Matlab software (‘codes’) for others to duplicates these results.

Any comments would be very welcome. I am going to be using the parallel features of Matlab more in coming weeks. It’s good practise, as we seem mainstream 4, 8 and soon 12 core desktops. I have also been experimenting with using CUDA on Matlab, and can recommend the ‘gp-you’ toolbox, which makes CUDA on Matlab easy to learn. It’s yet to be a full-power toolbox though, and is missing things like random number generation on the GPU, essential for monte-carlo simulations.

Download full article (PDF)