Running into a Java exception error related to Yahoo Finance

2 views (last 30 days)
I've read as many threads as possible relating to Yahoo Finance changing their API and workarounds, however I've been unsuccesful in getting this to work.
The code below is where the error occurs, specifcally this:
Error using Untitled2 (line 179)
Java exception occurred:
java.lang.NullPointerException
at ice.net.HttpURLConnection.getInputStream(OEAB)
at java.net.URL.openStream(URL.java:1045)
Line 179 is "OpenStream(..."
% Yahoo! finance reports EV/EBITDA on each stock's Key Statistics page.
% pre-allocate EV/EBITDA for speed -- how to preallocate cells?
for jj = 1:ii
stockURL = ['https://finance.yahoo.com/q/ks?s=' tick{jj} '+Key+Statistics'];
%disp(tick{jj}); % Used for debug purposes
buffer = java.io.BufferedReader(...
java.io.InputStreamReader(...
openStream(...
java.net.URL(stockURL))));
loop = 1;

Answers (0)

Products


Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!