Page 2 of 4
Re: GetStocks (fetch stock data)
Posted: Sat Jan 15, 2011 5:25 pm
by rod_jensen
Fantastic. Thanks a million.
Re: GetStocks (fetch stock data)
Posted: Sun Feb 06, 2011 12:33 pm
by acslks
I cannot download commodity futures or indices. Is everything on Yahoo Finance able to be downloaded?
GetStocks (fetch stock data)
Posted: Sun Feb 06, 2011 2:28 pm
by EViews Gareth
Which indices?
Re: GetStocks (fetch stock data)
Posted: Mon Feb 14, 2011 9:52 am
by Tom Simpson
Love this code, you guys are awesome. I tweaked the code a little (tweaked code attached) so that it pullls australian stock market data rather than US (can't just use the icharts .ax suffix as this would imply a period in the output eviews object names). australian users might find it useful.
Re: GetStocks (fetch stock data)
Posted: Mon Feb 14, 2011 10:00 am
by EViews Gareth
nifty.
Re: GetStocks (fetch stock data)
Posted: Mon Feb 14, 2011 11:17 am
by tchaithonov
Would it be even better if you combine the two programs by adding an "Australia or United States" radio button on the ui?
Re: GetStocks (fetch stock data)
Posted: Mon Feb 14, 2011 11:25 am
by EViews Gareth
Even better would be a drop down with a whole bunch of countries to select from.
I'm a bit tied down with other projects at the moment, but I'll put some thought into a refresh at some point in the future (unless anyone else wants to take a stab).
Re: GetStocks (fetch stock data)
Posted: Mon Feb 14, 2011 11:30 am
by Tom Simpson
Would it be even better if you combine the two programs by adding an "Australia or United States" radio button on the ui?
i could probably do that actually, there are only a few lines needed changing... just have a radio button attached to a !market = 1, have "if !market >0 then /bla bla bla with the .ax suffix/ else /"bla bla bla without the .ax" /endif each time the lines come up...
i was just adding in some code to pulll mcap and book/val ratios (lil bit more tricky), i might get back to the us/aus switch afterwards
Re: GetStocks (fetch stock data)
Posted: Mon Feb 14, 2011 11:37 am
by EViews Gareth
If you're fiddling around with the code, somewhere in there I put in a hack to allow stocks with names that EViews doesn't like:
Code: Select all
if @left(%stock,1) = "^" then 'handle the case where a stock name starts with "^", which is an invalid EViews name.
%stock = "_" + @mid(%stock,2)
endif
This could probably be change to use the @makevalidname function, which would handle all illegal characters, rather than just a starting "^". That might help you out with your periods too.
Re: GetStocks (fetch stock data)
Posted: Mon Feb 14, 2011 11:46 am
by Tom Simpson
If you're fiddling around with the code, somewhere in there I put in a hack to allow stocks with names that EViews doesn't like:
Code: Select all
if @left(%stock,1) = "^" then 'handle the case where a stock name starts with "^", which is an invalid EViews name.
%stock = "_" + @mid(%stock,2)
endif
This could probably be change to use the @makevalidname function, which would handle all illegal characters, rather than just a starting "^". That might help you out with your periods too.
I saw that, v. clever but I think the radio button solution is probably the way to go (if only because i can default it to .ax, saves me having to add .ax all the time!). Most users probably arent familiar with the icharts .ax suffix as it is so keeping it simple is probably better - but of course adapting your hack would allow (i presume) the use of ALL the stocks on the icharts db, pretty cool.... hmmm...
Re: GetStocks (fetch stock data)
Posted: Fri Mar 04, 2011 5:27 pm
by EViews Esther
Added new features.
Re: GetStocks (fetch stock data)
Posted: Fri Mar 04, 2011 7:35 pm
by terrya
While this change might seem great to some, it appears that you have destroyed some of the flexibility of the previous version. Previously, I had no trouble downloading mixed currency stocks (e.g. ^nz50,^aord,^gspc,^nyse, ....etc). Now I can't. So a number of programmes that used the old version have been rendered useless. Do you think you could resore the previous version under a new name perhaps.
Re: GetStocks (fetch stock data)
Posted: Fri Mar 04, 2011 8:08 pm
by EViews Gareth
It shouldn't have broken anything. We'll fix it.
Until then, I've uploaded the old one
here
Re: GetStocks (fetch stock data)
Posted: Fri Mar 04, 2011 8:23 pm
by terrya
The problem is that us stocks have to have us currency, nz stocks nz currency, aussie stoocks aussie currency, etc. I liked the old programme because I could download sp500, nz50, aord etc into a single workfile and EViews did the date matching for me to make it easier to get a common sample. The new version can't do this. I've included a sample of code to show you what I've been able to do. Also, it seemed to me that the new add-in didn't always create a new workfile when I wanted it to so do.
Code: Select all
'change path
%path = @runpath
cd %path
'retrieve data
getstocks(c, start = "2010/01/01", end="2011/12/31") ^nz50 ^aord ^axjo ^gspc ^nya ^dji ^ixic
rename _aord_close aao
rename _axjo_close asx200
rename _dji_close dji
rename _gspc_close sp500
rename _ixic_close nasdaq
rename _nya_close nyse
rename _nz50_close nz50
group stocks aao asx200 dji nasdaq nyse nz50 sp500
save anzuscfsd.xls
Re: GetStocks (fetch stock data)
Posted: Fri Mar 04, 2011 8:29 pm
by terrya
Just used you quick-fix and it works as in the past.