NAME
App::fiatx - Fiat currency exchange rate tool
VERSION
This document describes version 0.005 of App::fiatx (from Perl distribution App-fiatx), released on 2018-06-19.
SYNOPSIS
See the included script fiatx.
FUNCTIONS
all_spot_rates
Usage:
all_spot_rates(%args) -> [status, msg, result, meta]
Get all spot (latest) rates from a source.
This function is not exported.
Arguments ('*' denotes required arguments):
db_name* => str
db_password => str
db_username => str
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.
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)
sources
Usage:
sources() -> [status, msg, result, meta]
List available sources.
This function is not exported.
No arguments.
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)
spot_rate
Usage:
spot_rate(%args) -> [status, msg, result, meta]
Get spot (latest) rate.
This function is not exported.
Arguments ('*' denotes required arguments):
db_name* => str
db_password => str
db_username => str
from* => currency::code
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.to* => currency::code
type => str (default: "sell")
Which rate is wanted? e.g. sell, buy.
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)
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/App-fiatx.
SOURCE
Source repository is at https://github.com/perlancar/perl-App-fiatx.
BUGS
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-fiatx
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
SEE ALSO
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
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.