MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Oil and gold price chart, for your interest

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103223] Oil and gold price chart, for your interest
  • From: Chris Degnen <degnen at cwgsy.net>
  • Date: Fri, 11 Sep 2009 05:24:24 -0400 (EDT)

spotPrices =
  Import["http://www.eia.doe.gov/emeu/international/Crude1.xls";,
   "XLS"];
spotPriceWTI = {#[[1, 1 ;; 3]], #[[4]]} & /@
   DeleteCases[
    spotPrices[[1, 2 ;;]], {_, _, _, "NA"} | {_, _, _, ""}];
goldPrices =
  Import["http://www.lbma.org.uk/?area=stats&page=gold/2009dailygold";,
    "HTML"];
goldPrices2 = StringSplit[goldPrices, "\n"];
Take[goldPrices2, 9];
goldPrices3 = Drop[goldPrices2, 8];
Take[goldPrices2, -21];
goldPrices4 = Drop[goldPrices3, -20];
goldPrices5 =
  DeleteCases[If[StringLength[#] > 10, #, Null] & /@ goldPrices4,
   Null];
goldPrices6 = {StringTake[#, 9], StringTake[#, {11, 16}]} & /@
   goldPrices5;
goldPrices7 = {DateList[#[[1]]], ToExpression[#[[2]]]/10} & /@
   goldPrices6;
pricesPlot =
  DateListPlot[{goldPrices7,
    Take[spotPriceWTI, 7 - Length[goldPrices7]]},
   PlotLabel -> Style["\n2009 Oil and Gold Prices ($)", Bold],
   Joined -> True, PlotRange -> {Automatic, {0, 110}},
   FrameTicks -> {{{{0, "0"}, {20, "20"}, {40, "40"}, {60, "60"}, {80,
         "80"}, {100, "100"}},
      {{0, "0"}, {20, "200"}, {40, "400"}, {60, "600"}, {80,
        "800"}, {100, "1000"}}}, Automatic}];
Show[pricesPlot]


  • Prev by Date: Re: Re: how to get the longest ordered sub sequence of a
  • Next by Date: Re: Import "HeldExpression" element of MX file
  • Previous by thread: Re: Produce PDFs of Documentation notebooks?
  • Next by thread: Re: Oil and gold price chart, for your interest