Dow Jones and UBS publish one of the most popular commodity index families, the Dow Jones-UBS Commodity Index and its subindices. They provide a detailed manual describing the composition of the index and its daily changes, available at https://us.spindices.com/indices/commodities/dow-jones-commodity-index

I have tried to implement code that follows the description in the manual, but given the closing prices of the various components, I can't match the end-of-day values published by DJUBS.

Has anybody here succeeded in this task, and willing to share their work? Any programming language will probably do, the form of the computation is going to be the same however it's developed.

-- for those who want more detail, see the below

  1. Proper computation methodology is described in the DJUBS Commodity Index Handbook, which is available on the page I link to above. The best summary of the process appears on page 13 of the book, where it reads "Once the Commodity Index Multipliers are determined, the calculation of the DJ-UBS CI is an arithmetic process whereby the CIMs for the Index Commodities are multiplied by the respective prices in U.S. dollars for the applicable Designated Contracts. The products are then summed. The daily percentage change in this sum is then applied to the prior day's DJ-UBS CI value to calculate the then current DJ-UBS CI value."

    So we need to multiply the Commodity Index Multipliers (which are determined annually, and listed in the handbook) by the US Dollar prices for the designated contracts (the commodities in question are listed in the handbook, as is the table for selecting which future to own at any given time). Sum the CIM*DollarPrice for two dates and scale the index by the percentage change between the dates (assuming we are not in the roll period, which for the sake of simplicity, let's assume we're not).

  2. The CIMs appear on page 34 of the handbook.

  3. The future selection table appears on page 35

  4. Multipliers for USD price conversion appear on page 36

My code is in Mathematica and here since people are asking:

djubsCashFrom2012[dateList_List] := 
     futureFromDate[dateList, preppedCIMs[[i]][[1]], 
      calendar -> "djubs", offset -> 0, rolloverRule -> "djubs"], 
     dateList], {i, 1, Length[preppedCIMs]}]]

So you have an idea of the components, here's the list of contracts involved

{{"Aluminum", "LAN2 Comdty"}, {"Brent Crude", 
  "COU2 Comdty"}, {"Coffee", "KCN2 Comdty"}, {"Copper", 
  "HGN2 Comdty"}, {"Corn", "C N2 Comdty"}, {"Cotton", 
  "CTN2 Comdty"}, {"Gold", "GCQ2 Comdty"}, {"Heating Oil", 
  "HON2 Comdty"}, {"Lean Hogs", "LHN2 Comdty"}, {"Live Cattle", 
  "LCQ2 Comdty"}, {"Natural Gas", "NGN2 Comdty"}, {"Nickel", 
  "LNN2 Comdty"}, {"Silver", "SIN2 Comdty"}, {"Soybean Oil", 
  "BON2 Comdty"}, {"Soybeans", "S N2 Comdty"}, {"Sugar", 
  "SBN2 Comdty"}, {"Unleaded Gasoline (RBOB)", 
  "XBN2 Comdty"}, {"Wheat", "W N2 Comdty"}, {"WTI Crude", 
  "CLN2 Comdty"}, {"Zinc", "LXN2 Comdty"}}

Here's the list of USD multipliers

{{"Aluminum", 1}, {"Brent Crude", 1}, {"Coffee", 
    100}, {"Copper", 100}, {"Corn", 100}, {"Cotton", 100}, {"Gold", 
    1}, {"Heating Oil", 1}, {"Lean Hogs", 100}, {"Live Cattle", 
    100}, {"Natural Gas", 1}, {"Nickel", 1}, {"Silver", 
    100}, {"Soybean Oil", 100}, {"Soybeans", 100}, {"Sugar", 
    100}, {"Unleaded Gasoline (RBOB)", 1}, {"Wheat", 
    100}, {"WTI Crude", 1}, {"Zinc", 1}};

And here's the Commodity Index Multipliers

{{"Aluminum", 0.12200124`}, {"Brent Crude", 
    2.01846373`}, {"Coffee", 49.71828827`}, {"Copper", 
    88.13795172`}, {"Corn", 44.42764359`}, {"Cotton", 
    89.42000933`}, {"Gold", 0.25961493`}, {"Heating Oil", 
    48.39480046`}, {"Lean Hogs", 107.9219512`}, {"Live Cattle", 
    129.4759932`}, {"Natural Gas", 148.9289604`}, {"Nickel", 
    0.00589452`}, {"Silver", 4.1377227`}, {"Soybean Oil", 
    282.7408585`}, {"Soybeans", 25.37581892`}, {"Sugar", 
    691.6310707`}, {"Unleaded Gasoline (RBOB)", 
    52.80986115`}, {"Wheat", 34.03893139`}, {"WTI Crude", 
    4.07921265`}, {"Zinc", 0.07223231`}};

For a simple test, take the commodity prices on 5/15 and 5/16 of this year

5/15 prices

{{"Aluminum", 2013.}, {"Brent Crude", 111.45}, {"Coffee", 
  178.4}, {"Copper", 351.75}, {"Corn", 597.25}, {"Cotton", 
  79.16}, {"Gold", 1557.1}, {"Heating Oil", 293.86}, {"Lean Hogs", 
  86.4}, {"Live Cattle", 116.425}, {"Natural Gas", 2.568}, {"Nickel", 
  16977.}, {"Silver", 28.08}, {"Soybean Oil", 51.47}, {"Soybeans", 
  1413.}, {"Sugar", 20.4}, {"Unleaded Gasoline (RBOB)", 
  289.16}, {"Wheat", 608.5}, {"WTI Crude", 94.35}, {"Zinc", 1931.75}}

5/16 prices

{{"Aluminum", 2023.}, {"Brent Crude", 109.75}, {"Coffee", 
  178.}, {"Copper", 347.8}, {"Corn", 620.}, {"Cotton", 
  76.97}, {"Gold", 1536.6}, {"Heating Oil", 290.39}, {"Lean Hogs", 
  86.5}, {"Live Cattle", 116.875}, {"Natural Gas", 2.687}, {"Nickel", 
  16985.}, {"Silver", 27.196}, {"Soybean Oil", 50.43}, {"Soybeans", 
  1422.}, {"Sugar", 20.73}, {"Unleaded Gasoline (RBOB)", 
  286.51}, {"Wheat", 638.75}, {"WTI Crude", 93.19}, {"Zinc", 1895.75}}

The index change as published by DJUBS from June 15 to Jun 16 was +.328% but using my methodology I get -.866%.

  • $\begingroup$ Can you show the code that you wrote? We might be able to debug it here. $\endgroup$ – chrisaycock May 29 '12 at 19:48
  • $\begingroup$ And probably you should add along with the code what the procedure in the manual is. Or at least provide the link to it. $\endgroup$ – SRKX May 30 '12 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.