Mathematica 9 is now available
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: [mg106086] Re: Financial Data - Currencies
  • From: Chris Degnen <degnen at cwgsy.net>
  • Date: Fri, 1 Jan 2010 05:34:06 -0500 (EST)
  • References: <hhhmok$obj$1@smc.vnet.net>

On 31 Dec, 08:18, robert prince-wright <robertprincewri... at yahoo.com>
wrote:
> Does anyone know how to get the names corresponding to the currencies available from FinancialData? If you use the command below you get a list of 153 currencies - some of which are obscure so i was hoping to generate the names!
>
> currencyTickers = FinancialData["Currencies"]
>
> Also, why does FinancialData not give historical data for say GBP/USD? EUR/USD works, albeit over a limited time span, so you would think the data would be there for sterling. Several others don't work either.... perhaps this is a data server issue?
>
> R

Here's some code for getting exchange rate history.  Note the pages on
the Fed have slightly differing formats and are parsed accordingly.
Fortunately they don't change over time.
(If you're reading this post on the MathGroup beware the posting
program may have inserted semi-colons after the URLs.  If so, they
should be deleted.)

(* 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/GBP",12,Bold,Hue[0.67,0.6,0.6]],Automatic,{-4,1}]}]];


  • Prev by Date: Re: Replace and ReplaceAll -- simple application
  • Next by Date: Re: More /.{I->-1} craziness
  • Previous by thread: Re: Financial Data - Currencies
  • Next by thread: Re: Re: Financial Data - Currencies