MATLAB Answers

Running into a Java exception error related to Yahoo Finance

4 views (last 30 days)
Keith Powell
Keith Powell on 26 Nov 2019
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;

  0 Comments

Sign in to comment.

Answers (0)

Sign in to answer this question.

Products


Release

R2019b