Reading in stock data from a website?
1 view (last 30 days)
Show older comments
I'm trying to use an existing .m file from a user (https://www.mathworks.com/matlabcentral/fileexchange/41940-james-o-shaughnessey-s-trending-value-screener). It appears that the file no longer is reading in data from a URL. The file hangs indefinitely until it is manually terminated. It appears no data is being read in. I'm not familiar with any of the java functions and reading the help files hasn't really helped much. Any suggestions or help would be appreciated. Thank you!
2 Comments
Geoff Hayes
on 5 Dec 2018
Travis - have you tried stepping through the code to see what is happening? The stock URL (http://finviz.com/screener.ashx?v=152&f=cap_smallover&ft=4&c=0,1,2,6,7,10,11,13,14,45,65) is valid so it could be that there is a lot of data that has to be parsed (from the link, there appears to be about 176 pages and this code presumably reads each one).
Kevin Chng
on 6 Dec 2018
Download stock data from yahoo : https://www.mathworks.com/matlabcentral/fileexchange/68361-yahoo-finance-data-downloader
Or if you have datafeed toolbox, you may fetch data from those financial platform : bloomberg, fred, havar analytica, reuter thomson,...However, this web is not in the list of datafeed toolbox : https://finviz.com/screener.ashx?v=152&f=cap_smallover&ft=4&c=0,1,2,6,7,10,11,13,14,45,65
Accepted Answer
Travis L
on 7 Dec 2018
3 Comments
Simon Prüller
on 25 Feb 2021
Hallo Travis, do you know how i can add a 'User-Agent' to the Java-Part? Because i get this Error:
Java exception occurred:
java.io.IOException: Server returned HTTP response code: 403 for URL: https://finviz.com/screener.ashx?v=152&f=cap_smallover&ft=4&c=0,1,2,6,7,10,11,13,14,45,65
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1894)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
at java.net.URL.openStream(URL.java:1045)
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!