Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Financial Data - Currencies

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106165] Re: Financial Data - Currencies
  • From: "Chris Degnen" <degnen at cwgsy.net>
  • Date: Sun, 3 Jan 2010 03:43:06 -0500 (EST)

"E. Martin-Serrano" <eMartinSerrano at telefonica.net> wrote in message news:hhn5tq$7d0$1 at smc.vnet.net...
> Hi,
>
> The Import/connection . . .
> fails to work in my computer and returns $Failed plus the following message:
>

Posting through a web-based emailer added line breaks to the URLs and a text string.

(* Extract EUR/USD exhange rate *)
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;
(* Extract GBP/USD exhange rate *)
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;
(* Plot exchange rates *)
Print[DateListPlot[{euData5, ukData5}, ImageSize -> 600,
PlotLabel -> Style["\nExchange Rate History", 20], Joined -> True,
Epilog -> {Inset[Style["GBP/USD", 12, Bold, Hue[106/117, 0.6, 0.6]],
Automatic, {6, -7}],
Inset[Style["EUR/USD", 12, Bold, Hue[0.67, 0.6, 0.6]],
Automatic, {-4, 1}]}]];


  • Prev by Date: Re: More /.{I->-1} craziness
  • Next by Date: Re: Difficulty with NDSolve (and DSolve)
  • Previous by thread: Re: Re: Financial Data - Currencies
  • Next by thread: Re: Re: Financial Data - Currencies