Re: Stock tracking
- To: mathgroup at smc.vnet.net
- Subject: [mg107890] Re: Stock tracking
- From: eric g <eric.phys at gmail.com>
- Date: Tue, 2 Mar 2010 03:36:09 -0500 (EST)
When I try to run below code Mathematica can't access the file. I check in Help the internet connectivity and said 'connectivvity test succeded using wolfram...' I need help in setting up Mathematica propertly to access https from mathematica. best regards, Eric (*Import crude oil security:tracks 1 month futures*) rawCrud = Import["http://www.etfsecurities.com/en/aum/ Historical_NAV_Outstanding_AUM.zip", "*"]; crudPosition = Position[rawCrud[[1, 1, 3]], "CRUD"][[1, 1]]; crudDates = Drop[rawCrud[[1, 1, All, 1]], 3]; crud = Drop[rawCrud[[1, 1, All, crudPosition]], 3]; crudT = Transpose[{crudDates, crud}]; Export["crud.mx", crudT]; etchURL::conopen: The connection to URL https://www.etfsecurities.com/en/aum/ Historical_NAV_Outstanding_AUM.zip 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). For HTTPS connections, you might need to inspect the authenticity of the server's SSL certificate and choose to accept it. On 02/25/2010 02:36 PM, Chris Degnen wrote: > Similar to examples I've posted earlier. This one plots oil and gold > securities. > Some lines, probably the URLs, may break in the post and could need > rejoining. > > (* Import crude oil security: tracks 1 month futures *) > rawCrud = > Import["http://www.etfsecurities.com/en/aum/ > Historical_NAV_Outstanding_AUM.zip", "*"]; > crudPosition = Position[rawCrud[[1, 1, 3]], "CRUD"][[1, 1]]; > crudDates = Drop[rawCrud[[1, 1, All, 1]], 3]; > crud = Drop[rawCrud[[1, 1, All, crudPosition]], 3]; > crudT = Transpose[{crudDates, crud}]; > Export["crud.mx", crudT]; > > (* Import gold bullion security *) > gbss = Import[ > "http://www.exchangetradedgold.com/assets/dynamic/ETG/ > GBS_UK_GBP_archive.csv"]; > gbssData = Drop[gbss, 5]; > gbssDates = gbssData[[All, 1]]; > gbssPrice = gbssData[[All, 3]]; > gbssPlot = Cases[Transpose[{gbssDates, gbssPrice}], {_, _?NumericQ}]; > Export["gbss.mx", gbssPlot]; > > (* Optionally, import saved values *) > crudT = Import["crud.mx"]; > gbssPlot = Import["gbss.mx"]; > > (* Plotting *) > gbssGBP = {#[[1]], #[[2]]/100}& /@ gbssPlot; > DateListPlot[{crudT, gbssGBP}, Joined -> True, > PlotLabel -> Style["\nGold Bullion and Crude Oil Futures", Large], > FrameLabel -> {{Style["=A3", Hue[106/117, 0.6, 0.6], Large], > Style["$", Hue[0.67, 0.6, 0.6], Large]}, {Null, Null}}, > RotateLabel -> False, ImageSize -> 450, > PlotRange -> {Automatic, {0, 100}}, > Epilog -> {Inset[Style["GBSS:LSE", 12, Bold, Hue[106/117, 0.6, 0.6]], > Automatic, {-4.5, -6}], > Inset[Style["CRUD:LSE", 12, Bold, Hue[0.67, 0.6, 0.6]], > Automatic, {-4.5, 7}]}] > >