Scroll to navigation

Finance::Quote::AlphaVantage(3pm) User Contributed Perl Documentation Finance::Quote::AlphaVantage(3pm)

NAME

Finance::Quote::AlphaVantage - Obtain quotes from https://iexcloud.io

SYNOPSIS

    use Finance::Quote;
    
    $q = Finance::Quote->new('AlphaVantage', alphavantage => {API_KEY => 'your-alphavantage-api-key'});
    %info = $q->fetch('alphavantage', 'IBM', 'AAPL');

DESCRIPTION

This module fetches information from https://www.alphavantage.co.

This module is loaded by default on a Finance::Quote object. It's also possible to load it explicitly by placing "AlphaVantage" in the argument list to Finance::Quote->new().

This module provides the "alphavantage" fetch method.

API_KEY

https://www.alphavantage.co requires users to register and obtain an API key, which is also called a token. The token is a sequence of random characters.

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 ALPHAVANTAGE_API_KEY.

LABELS RETURNED

The following labels may be returned by Finance::Quote::AlphaVantage : symbol, open, close, high, low, last, volume, method, isodate, currency.

CAVEATs

Since the JSON returned by the GLOBAL_QUOTE API does not specify the currency of the price data, there is no way to determine the correct currency without an additional call to the SYMBOL_SEARCH API. To avoid even slower throttling, this module expects the user to know which securties from certain countries may be traded in the non-ISO4217 currency.

An example are London Stock Exchange traded GBP.L (Global Petroleum Limited) and GBPG.L (Goldman Sachs Access UK Gilts 1-10 Years UCITS ETF CLASS GBP (Dist)). GBP.L is traded in GBX, which is also known as GBp (Great Britain Pence), and GBPG.L is traded in the iso-4217 currency GBP (Great Britain Pounds). The user will need to add ".X" to symbols to return GBX priced securities as GBP. For the example above the user would use the symbol GBP.L.X in the call to the alphavantage method for the prices to be output as GBP.

2024-04-21 perl v5.38.2