NAME
Finance::Quote::CurrencyRates::AllRatesToday - Obtain currency rates from https://allratestoday.com/api/open/
SYNOPSIS
use Finance::Quote;
# European Central Bank reference rates (30 currencies)
$q = Finance::Quote->new(currency_rates => {order => ['AllRatesToday']});
$value = $q->currency('18.99 EUR', 'USD');
# Official table of one central bank, e.g. the Saudi Central Bank
$q = Finance::Quote->new(currency_rates => {order => ['AllRatesToday'],
allratestoday => {BANK => 'sama'}});
$value = $q->currency('100.00 SAR', 'USD');
DESCRIPTION
This module fetches currency rates from the keyless AllRatesToday open endpoints and provides data to Finance::Quote to convert the first argument to the equivalent value in the currency indicated by the second argument.
Without options it uses the European Central Bank reference table re-based on the source currency (https://allratestoday.com/api/open/latest/EUR).
With the BANK option it uses the latest official table published by that central bank (https://allratestoday.com/api/open/central-bank/sama). Codes are listed at https://allratestoday.com/central-bank-rates-api/institutions/ and include banks that other free aggregators do not carry, such as the Saudi Central Bank (sama), Central Bank of the UAE (cbuae), Qatar Central Bank (qcb), Bank of Korea (bok), Reserve Bank of New Zealand (rbnz), State Bank of Vietnam (sbv) and Bangladesh Bank (bb). When a bank publishes several rate types for a pair, the reference rate is used, else the middle/official rate, else the mean of the buy and sell rates.
This module is not the default currency conversion module for a Finance::Quote object. It can be utilized by setting the environment variable FQ_CURRENCY=AllRatesToday. The bank can also be set with the environment variable ALLRATESTODAY_BANK, the API key with ALLRATESTODAY_API_KEY.
API_KEY
The keyless endpoints do not require an API key. With the optional API_KEY option (free or paid key from https://allratestoday.com/register) the central-bank table is read from the keyed endpoint https://allratestoday.com/api/v1/central-bank/<bank>/latest instead.
Terms & Conditions
Use of https://allratestoday.com/api/ is governed by the terms of that site (https://allratestoday.com/terms/). Keyless use is for non-commercial use and asks for a visible link to https://allratestoday.com where the rates are displayed; commercial use needs a key on a paid plan.
Finance::Quote is released under the GNU General Public License, version 2, which explicitly carries a "No Warranty" clause.