Re: Financial Data - Currencies
- To: mathgroup at smc.vnet.net
- Subject: [mg106162] Re: Financial Data - Currencies
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Sun, 3 Jan 2010 03:42:32 -0500 (EST)
- References: <hhhmok$obj$1@smc.vnet.net> <201001011034.FAA05112@smc.vnet.net>
- Reply-to: drmajorbob at yahoo.com
I was getting spurious spaces at the end of lines, not semicolons. Getting rid of those spaces fixed the code. Bobby On Sat, 02 Jan 2010 04:08:17 -0600, E. Martin-Serrano <eMartinSerrano at telefonica.net> wrote: > Hi, > > Hi, > > The Import/connection > > euData1 = Import["http://www.federalreserve.gov/releases/h10/hist/ > dat00_eu.txt", "Data"] > > fails to work in my computer and returns $Failed plus the following > message: > > **FetchURL::conopen: The connection to URL > http://www.federalreserve.gov/releases/h10/hist/ > dat00_eu.txt cannot be opened. If the URL is correct, you might need > to configure your firewall program, or you might need to set a proxy > in the Internet Connectivity tab of the Preferences dialog (or by > calling SetInternetProxy).** > > My SetInternetProxy setting in the *preferences* tab is: *Use Proxy > settings > from my system or browser* > > However, the direct connection via browser works fine, so it should work > inside the Mathematica expression too, I think. And I do not see any > semicolon after the URL, as you warn, in the MathGroup post. > > E. Martin-Serrano > > -----Original Message----- > From: Chris Degnen [mailto:degnen at cwgsy.net] > Sent: Friday, January 01, 2010 11:34 AM > To: mathgroup at smc.vnet.net > Subject: [mg106142] [mg106086] Re: Financial Data - Currencies > > 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}]}]]; > > -- DrMajorBob at yahoo.com
- References:
- Re: Financial Data - Currencies
- From: Chris Degnen <degnen@cwgsy.net>
- Re: Financial Data - Currencies