Matthew Cassar Matthew Cassar - 2 years ago 84
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?


Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download