Matthew Cassar Matthew Cassar - 6 months ago 10
Java Question

financequotes API returning null values

I have downloaded an API called "financequotes" for Java (Link: and have attempted to use it for a project. It has been imported into my class path and all the methods run, however when I ask for a stocks details

Stock s = new Stock("INTC");

I am given back all the details which should have been obtained online as null including name, currency, quote, etc.

Why is this?

ALTERNATIVELY - Could you suggest another finance API which is relatively simple to use to gather basic financial data?



The creator of the API has answered - Here was the problem

The code doesn't have a request to Yahoo Finance yet. There's 2 alternative ways to fix this.

  1. Request it through the YahooFinance static methods

    Stock stock = YahooFinance.get("INTC");
  2. Force a refresh of the stock's quote by using the getQuote(boolean refresh) method

    Stock stock = new Stock("INTC");

This will automatically also load/refresh the statistics and dividend data.