MathGroup Archive 2009

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

Search the Archive

Re: For interest: oil prices with FX for comparison

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103934] Re: For interest: oil prices with FX for comparison
  • From: Chris Degnen <degnen at cwgsy.net>
  • Date: Tue, 13 Oct 2009 07:19:51 -0400 (EDT)
  • References: <200910081149.HAA13464@smc.vnet.net> <han6ab$pie$1@smc.vnet.net>

On 12 Oct, 11:38, DrMajorBob <btre... at austin.rr.com> wrote:
> No cigar.
>
> The first Import fails (file not found), even though clicking on the link=
  
> (in e-mail) downloads the spreadsheet.
>
> Methinks that Import is "not ready for prime time" on the Web.
>
> Bobby
>

This could be the problem: Somehow, the version that appears on the
MathGroup website has acquired an extra semicolon, placed before the
closing bracket of the Import statements. E.g. filename.xls";]

These semicolons aren't in the sent code, and don't appear on my
newsgroup feed or on the Google groups version.

http://tinyurl.com/googlegroupversion
http://tinyurl.com/mathgroupversion



>
>
>
>
> On Sat, 10 Oct 2009 06:11:46 -0500, Chris Degnen <deg... at cwgsy.net> wrote=
:
> > On 9 Oct, 12:20, DrMajorBob <btre... at austin.rr.com> wrote:
>
> >> None of those file Imports work at my machine. (M7, iMac Snow Leopard)
>
> > Ok, this version should be 'copy&paste'-proof.  The double whitespace
> > that was getting converted to a single space is now explicitly
> > written, e.g. StringReplace[#, " " <> " " .. -> ","]}
>
> > Will I be foiled again?!   (I doubt there's any problem with Import.)
>
> > Incidentally, it takes a while to load because the oil price
> > spreadsheet is quite large, and then the DateList conversions for the
> > FX data aren't very quick either.
>
> > Scaling the oil price in different currencies shows some interesting
> > FX differences.
>
> > Any coding improvement tips would be cheerfully received.  Regards
>
> > (*Oil price in dollars*)
> > spotPrices =
> >   First@Import[
> >     "http://www.eia.doe.gov/emeu/international/Crude1.xls";];
> > spotPriceWTI = Cases[spotPrices[[All, {1, 4}]], {_List, _?NumericQ}];
> > oilUSD = Select[spotPriceWTI, #[[1, 1]] >= 2000 &];
> > (*Oil price in euros*)
> > euData1 =
> >   Import[
> > "http://www.federalreserve.gov/releases/h10/hist/dat00_eu.txt";,
> > "Data"];
> > euData2 = {StringReplace[#, " " <> " " .. -> ","]} & /@ euData1;
> > euData3 = Select[euData2, StringLength[#] == {16} &];
> > euData4 = First[StringSplit[#, ","]] & /@ euData3;
> > euData5 = {DateList[#[[1]]], ToExpression[#[[2]]]} & /@ euData4;
> > oilEUR = DeleteCases[{Cases[euData5, {#[[1]], _}], #[[2]]} & /@
> >     oilUSD, {{}, _}];
> > (*Oil price in sterling*)
> > ukData1 =
> >   Import[
> > "http://www.federalreserve.gov/releases/h10/hist/dat00_uk.txt";,
> > "Data"];
> > ukData2 = {StringReplace[#[[1]], " " <> " " .. -> ","]} & /@ ukData1;
> > ukData3 = Select[ukData2, StringLength[#] == {17} &];
> > ukData4 = First[StringSplit[#, ", "]] & /@ ukData3;
> > ukData5 = {DateList[#[[1]]], ToExpression[#[[2]]]} & /@ ukData4;
> > oilGBP = DeleteCases[{Cases[ukData5, {#[[1]], _}], #[[2]]} & /@
> >     oilUSD, {{}, _}];
> > (*Oil Chart showing prices in dollars,euros and sterling*)
> > Manipulate[
> >  DateListPlot[{oilUSD, {#[[1, 1, 1]],
> >       EuroScaleFactor*#[[2]]/#[[1, 1, 2]]} & /@
> >     oilEUR, {#[[1, 1, 1]],
> >       SterlingScaleFactor*#[[2]]/#[[1, 1, 2]]} & /@ oilGBP},
> >   ImageSize -> 600,
> >   PlotLabel -> Style["Oil Prices - USD, EUR and GBP", Bold],
> >   Joined -> True,
> >   PlotRange -> {Automatic, {0, 160}}], {{EuroScaleFactor, 1}, 0, 2.5,
> >   Appearance -> "Labeled"}, {{SterlingScaleFactor, 1}, 0, 2.5,
> >   Appearance -> "Labeled"}]
>
> --
> DrMajor... at yahoo.com- Hide quoted text -
>
> - Show quoted text -



  • Prev by Date: On ~= (simulating a C structure) in Mathematica....
  • Next by Date: Re: generating submultisets with repeated elements
  • Previous by thread: Re: For interest: oil prices with FX for comparison
  • Next by thread: Re: For interest: oil prices with FX for comparison