I am just messing around with the yahoo finance API and Commons CSV. I am having trouble outputting the value for stock symbol AAPL. For some reason I keep returning HTML. When I double check the website, it does in fact return a CSV file that works.
Please help! I need to return the Symbol value (for testing right now)
URL yahooData = new URL("http://finance.yahoo.com/d/quotes.csv?s=AAPL&f=svogh");
Reader yahooReader = new InputStreamReader(new BOMInputStream(yahooData.openStream()), "UTF-8");
CSVParser yahooParser = new CSVParser(yahooReader,
CSVFormat.EXCEL.withHeader("Symbol", "Volume", "Open", "Low", "High"));
for (final CSVRecord record : yahooParser) {
System.out.println(record.get("Symbol"));
}
As of right now this is what the CSV file contains:
"AAPL",25473923,111.64,111.33,112.39