NAME
Finance::Quote::Finnhub - Obtain quotes from https://finnhub.io
SYNOPSIS
use Finance::Quote;
$q = Finance::Quote->new('Finnhub', finnhub => {API_KEY => 'your-finnhub-api-key'});
%info = $q->fetch('finnhub', 'AAPL', 'MSFT');
DESCRIPTION
This module fetches information from https://finnhub.io.
This module is loaded by default on a Finance::Quote object. It's also possible to load it explicitly by placing "Finnhub" in the argument list to Finance::Quote->new().
This module provides the "finnhub", "usa", "nyse", and "nasdaq" fetch methods.
API_KEY
https://finnhub.io requires users to register and obtain an API key (token). A free key is available with no credit card and is intended for personal, non-professional use.
The API key may be set by either providing a module specific hash to Finance::Quote->new as in the above example, or by setting the environment variable FINNHUB_API_KEY.
RATE LIMITING
The free tier permits 60 API calls per minute and this module makes one call per requested symbol. Requests are paced with a sliding window so that batches up to 60 symbols run at full speed and larger batches are slowed just enough to stay within the limit. Holders of a paid key may raise the limit by passing finnhub => { CALLS_PER_MINUTE => N } to Finance::Quote->new.
LABELS RETURNED
The following labels may be returned by Finance::Quote::Finnhub: symbol, last, open, high, low, close, net, p_change, date, isodate, currency, method.
CAVEATS
The free Finnhub tier covers US listed equities, ETFs, forex, and cryptocurrency. The trade date is derived from the last trade timestamp returned by the quote endpoint, interpreted in the local timezone.
The quote endpoint does not report a currency. Because the free tier only covers US listed securities, this module assumes all prices are in USD. Do not rely on the currency for securities priced in another currency.
Because requests are paced to honour the rate limit, fetching a large list of symbols can take longer than a minute and will block until it completes.