I am trying to pull stock data from yahoo finance using the yahoo finance api for java. My program was working absolutely fine up until yesterday, when this piece of code just stopped working, throwing up the following errors:
SEVERE: Unparseable date: "11/17/2014"
java.text.ParseException: Unparseable date: "11/17/2014"
at java.text.DateFormat.parse(DateFormat.java:337)
at yahoofinance.Utils.parseDividendDate(Utils.java:176)
at yahoofinance.quotes.stock.StockQuotesData.getDividend(StockQuotesData.java:87)
at yahoofinance.quotes.stock.StockQuotesData.getStock(StockQuotesData.java:105)
at yahoofinance.YahooFinance.getQuotes(YahooFinance.java:336)
at yahoofinance.YahooFinance.get(YahooFinance.java:76)
at yahoofinance.YahooFinance.get(YahooFinance.java:61)
at controlp5userinterface.ControlP5UserInterface.setup(ControlP5UserInterface.java:75)
at processing.core.PApplet.handleDraw(PApplet.java:2361)
at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240)
at processing.core.PApplet.run(PApplet.java:2256)
at java.lang.Thread.run(Thread.java:695)
Exception in thread "Animation Thread" java.lang.NullPointerException
at controlp5userinterface.ControlP5UserInterface.setup(ControlP5UserInterface.java:76)
at processing.core.PApplet.handleDraw(PApplet.java:2361)
at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240)
at processing.core.PApplet.run(PApplet.java:2256)
at java.lang.Thread.run(Thread.java:695)
Here is my code for the section that has stopped working, I can post the complete code if it is of any help. I know that the error is in parsing the date in the yahoo finance cvs file returned but I have no idea why its happening now when it worked perfectly beforehand.
Stock[] stocks = new Stock[symbols.length];
double[] quotePrices = new double[stocks.length];
for(int i = 0; i<stocks.length; i++){
String symbol = symbols[i];
stocks[i] = YahooFinance.get(symbol); //error is here
quotePrices[i] = stocks[i].getQuote().getPrice().doubleValue();
System.out.println("Price: " + quotePrices[i]);
}
System.out.println("Finished finance import");