From: DrMajorBob on 3 Jan 2010 03:39 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(a)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(a)cwgsy.net] > Sent: Friday, January 01, 2010 11:34 AM > To: mathgroup(a)smc.vnet.net > Subject: Re: Financial Data - Currencies > > On 31 Dec, 08:18, robert prince-wright <robertprincewri...(a)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(a)yahoo.com
From: Chris Degnen on 3 Jan 2010 03:39 "E. Martin-Serrano" <eMartinSerrano(a)telefonica.net> wrote in message news:hhn5tq$7d0$1(a)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}]}]];
From: Chris Degnen on 5 Jan 2010 01:45 DrMajorBob wrote: > >> (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.) > I was getting spurious spaces at the end of lines, not semicolons. I reposted the code via mathgroup(a)smc.vnet.net and the semi-colons duly appeared. I.e. http://forums.wolfram.com/mathgroup/archive/2010/Jan/msg00081.html They aren't on the Google group post. http://groups.google.co.uk/group/comp.soft-sys.math.mathematica/browse_frm/thread/a748e84b4dae1355?hl=en#
From: robert prince-wright on 6 Jan 2010 05:57 Thanks to all with help on my question about FinancialData. Bob hit the nail on the head by pointing out CountryData was the best source of information on country, currency name and currency code - at first sight this gives the information I was looking for, however as E. Martin-Serrano points out the exhange rate data available in FinancialData[] is virtually useless, i.e. no data or incomplete data! Hopefully this is something WRI will sort out if they can tear themselves away from WaLpHa. In the meantime Chris has shown how we can access the Federal Reserve data by importing the HTML as Data and then judiciously using Select, Cases etc. The ability to Import 'Live' webpages is pretty neat and opens up a wide rage of non-curated data which can be used to fill the gaps in what WRi are providing. For example, I check oil and gold price movement by by importing data on London commodities exchange webpages. It seems to work as long the data formats don't change. I was hoping to use Mathematica to keep track of the performance of my share portfolio, however, comments by E. Martin-Serrano made me question if FinancialData is accurate. I therefore used it to check the histories of a few shares and all were exactly the same as data reported using the history option in Yahoo Finance (it allows you to generate a csv file with open, close, high and low share price data but note you need to use RawOpen, RawClose etc in FinancialData). If you look at the help page below you will see that FinancialData is supposedly pulling some of its information from Xignite.com. This site provides a mountain of data: however, it's not clear, which Mathematica properties are used to access it - so if someone knows I would be interested to hear! http://reference.wolfram.com/mathematica/note/FinancialDataSourceInformation.html Robert ________________________________ From: Chris Degnen <degnen(a)cwgsy.net> Sent: Sun, January 3, 2010 2:43:06 AM Subject: Re: Financial Data - Currencies "E. Martin-Serrano" <eMartinSerrano(a)telefonica.net> wrote in message news:hhn5tq$7d0$1(a)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}]}]]; On 31 Dec, 08:18, robert prince-wright <robertprincewri...(a)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
First
|
Prev
|
Pages: 1 2 3 Prev: More /.{I->-1} craziness Next: Difficulty with NDSolve (and DSolve) |