Finance::Currency::FiatX - Fiat currency exchange rate library
This document describes version 0.006 of Finance::Currency::FiatX (from Perl distribution Finance-Currency-FiatX), released on 2018-06-24.
See fiatx from App::fiatx for an example on how to use this module.
FiatX is a library/application to convert one fiat currency to another using several backend modules ("sources", Finance::Currency::FiatX::Source::*, which in turns usually utilize Finance::Currency::Convert::*) and store the rates in DBI database for caching.
Finance::Currency::FiatX::Source::*
Finance::Currency::Convert::*
Usage:
get_all_spot_rates(%args) -> [status, msg, result, meta]
Get all spot rates from a source.
This function is not exported.
Arguments ('*' denotes required arguments):
dbh => obj
max_age_cache => posint (default: 14400)
Above this age (in seconds), we retrieve rate from remote source again.
source* => str (default: ":any")
Ask for a specific remote source.
If you want a specific remote source, you can specify it here. The default is ':any' which is to pick the first source that returns a recent enough current rate.
Other special values: :highest to return highest rate of all sources, :lowest to return lowest rate of all sources, ':newest' to return rate from source with the newest last update time, ':oldest' to return rate from source with the oldest last update time, ':average' to return arithmetic average of all sources.
:highest
:lowest
table_prefix => str (default: "fiatx_")
Returns an enveloped result (an array).
First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.
Return value: (any)
get_spot_rate(%args) -> [status, msg, result, meta]
Get spot (latest) rate.
from* => currency::code
source => str (default: ":any")
to* => currency::code
type => str (default: "sell")
Which rate is wanted? e.g. sell, buy.
Please report all bug reports or feature requests to mailto:stevenharyanto@gmail.com.
Finance::Currency::Convert::* modules.
perlancar <perlancar@cpan.org>
This software is copyright (c) 2018 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Finance::Currency::FiatX, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Finance::Currency::FiatX
CPAN shell
perl -MCPAN -e shell install Finance::Currency::FiatX
For more information on module installation, please visit the detailed CPAN module installation guide.