Class FinnhubClient

java.lang.Object
com.github.oscerd.finnhub.client.FinnhubClient

public class FinnhubClient extends Object
  • Constructor Details

    • FinnhubClient

      public FinnhubClient()
    • FinnhubClient

      public FinnhubClient(String token)
    • FinnhubClient

      public FinnhubClient(String token, com.google.gson.Gson gson)
  • Method Details

    • getToken

      public String getToken()
    • setToken

      public void setToken(String token)
    • getGson

      public com.google.gson.Gson getGson()
    • setGson

      public void setGson(com.google.gson.Gson gson)
    • getHttpClient

      public org.apache.hc.client5.http.impl.classic.CloseableHttpClient getHttpClient()
    • setHttpClient

      public void setHttpClient(org.apache.hc.client5.http.impl.classic.CloseableHttpClient httpClient)
    • quote

      public Quote quote(String symbol) throws IOException, org.apache.hc.core5.http.ParseException
      Get the current quote for a specific symbol
      Parameters:
      symbol - Ticker symbol
      Returns:
      JSON object with arrays for the current price, change, percent change, high, low, open and previous close price
      Throws:
      IOException
      org.apache.hc.core5.http.ParseException
    • candle

      public StockCandles candle(String symbol, String resolution, long startEpoch, long endEpoch) throws IOException, org.apache.hc.core5.http.ParseException
      Get the Stock Candle object for a date or a range. Set startEpoch equal to the endEpoch for one day.
      Parameters:
      symbol - Ticker symbol
      resolution - Supported resolution includes 1, 5, 15, 30, 60, D, W, M. Some timeframes might not be available depending on the exchange.
      startEpoch - In seconds, not milliseconds.
      endEpoch - As above.
      Returns:
      JSON object with arrays for the close, low, high, open, volume. status is a String.
      Throws:
      IOException
      org.apache.hc.core5.http.ParseException
    • companyProfile

      public CompanyProfile2 companyProfile(String symbol) throws IOException, org.apache.hc.core5.http.ParseException
      Get the company profile for a specific symbol
      Parameters:
      symbol - Ticker symbol
      Returns:
      JSON object with information about the company
      Throws:
      IOException
      org.apache.hc.core5.http.ParseException
    • symbols

      public List<StockSymbol> symbols(String exchange) throws IOException, org.apache.hc.core5.http.ParseException
      List the supported stocks for a specific market exchange
      Parameters:
      exchange - Market exchange
      Returns:
      JSON array with list of supported stocks enriched with more details
      Throws:
      IOException
      org.apache.hc.core5.http.ParseException
    • searchSymbol

      public SymbolLookup searchSymbol(String query) throws IOException, org.apache.hc.core5.http.ParseException
      Query for a specific stock symbol
      Parameters:
      query - Query text can be symbol, name, isin, or cusip.
      Returns:
      JSON array with list of supported stocks enriched with more details
      Throws:
      IOException
      org.apache.hc.core5.http.ParseException
    • marketStatus

      public MarketStatus marketStatus(String exchange) throws IOException, org.apache.hc.core5.http.ParseException
      Return market status for a specific stock exchange
      Parameters:
      exchange - Exchange code
      Returns:
      JSON object with market status
      Throws:
      IOException
      org.apache.hc.core5.http.ParseException
    • marketHoliday

      public MarketHoliday marketHoliday(String exchange) throws IOException, org.apache.hc.core5.http.ParseException
      Return market holidays for a specific stock exchange
      Parameters:
      exchange - Exchange code
      Returns:
      JSON arrays with the holidays for the specific stock exchange
      Throws:
      IOException
      org.apache.hc.core5.http.ParseException
    • dividends

      public List<Dividends> dividends(String symbol, String from, String to) throws IOException, org.apache.hc.core5.http.ParseException
      Return dividends history for a specific date range of a specific stock symbol
      Parameters:
      symbol - Exchange code
      from - from date with format YYYY-MM-DD
      to - from date with format YYYY-MM-DD
      Returns:
      JSON arrays with the dividends for specific date range
      Throws:
      IOException
      org.apache.hc.core5.http.ParseException
    • companyNews

      public List<CompanyNews> companyNews(String symbol, String from, String to) throws IOException, org.apache.hc.core5.http.ParseException
      Return company news for a specific date range of a specific stock symbol
      Parameters:
      symbol - Exchange code
      from - from date with format YYYY-MM-DD
      to - from date with format YYYY-MM-DD
      Returns:
      JSON arrays with the company news for specific date range
      Throws:
      IOException
      org.apache.hc.core5.http.ParseException
    • basicFinancials

      public BasicFinancials basicFinancials(String symbol, String metric) throws IOException, org.apache.hc.core5.http.ParseException
      Return company news for a specific date range of a specific stock symbol
      Parameters:
      symbol - Exchange code
      metric - the metric to return, supported value is only 'all'
      Returns:
      JSON arrays with the company basic financials such as margin, P/E ratio, 52-week high/low etc.
      Throws:
      IOException
      org.apache.hc.core5.http.ParseException