dev-perl/Finance-Quote: Add v1.520 with AlphaVantage patch.

Package-Manager: Portage-3.0.30, Repoman-3.0.3
This commit is contained in:
Manuel Friedli 2022-09-08 03:59:16 +02:00
parent 3593307469
commit 71b5f3492f
Signed by: manuel
GPG key ID: 41D08ABA75634DA1
5 changed files with 207 additions and 0 deletions

View file

@ -0,0 +1,5 @@
*Finance-Quote-1.520.0 (08 Sep 2022)
08 Sep 2022; Manuel Friedli <manuel@gentoo.org> +Finance-Quote-1.520.0.ebuild,
+files/alphavantage-currency.patch, +metadata.xml:
dev-perl/Finance-Quote: Add v1.520 with AlphaVantage patch.

View file

@ -0,0 +1,88 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DIST_AUTHOR=BPSCHUCK
DIST_VERSION=1.52
DIST_EXAMPLES=( "Examples/*" )
inherit perl-module
DESCRIPTION="Get stock and mutual fund quotes from various exchanges"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm64 ~ppc ~ppc64 ~riscv ~x86"
RDEPEND="
dev-perl/CGI
virtual/perl-Carp
dev-perl/DateTime
dev-perl/DateTime-Format-Strptime
virtual/perl-Encode
virtual/perl-Exporter
dev-perl/HTML-TableExtract
dev-perl/HTML-Parser
dev-perl/HTML-TokeParser-Simple
dev-perl/HTML-Tree
dev-perl/HTTP-Cookies
dev-perl/HTTP-Message
dev-perl/JSON
dev-perl/JSON-Parse
dev-perl/LWP-Protocol-https
dev-perl/libwww-perl
virtual/perl-Module-Load
dev-perl/Mozilla-CA
virtual/perl-Scalar-List-Utils
dev-perl/Spreadsheet-XLSX
dev-perl/String-Util
dev-perl/Text-Template
virtual/perl-Time-Piece
dev-perl/Try-Tiny
dev-perl/URI
dev-perl/Web-Scraper
dev-perl/XML-LibXML
virtual/perl-if
"
BDEPEND="${RDEPEND}
virtual/perl-ExtUtils-MakeMaker
test? (
virtual/perl-Data-Dumper
dev-perl/Date-Manip
dev-perl/Date-Range
dev-perl/Date-Simple
dev-perl/DateTime-Format-ISO8601
virtual/perl-File-Spec
virtual/perl-Test-Simple
)
"
PERL_RM_FILES=(
t/01-pod.t
t/02-pod-coverage.t
t/03-kwalitee.t
t/04-critic.t
t/author-pod-syntax.t
lib/GPATH
lib/GRTAGS
lib/GTAGS
)
PATCHES=(
"${FILESDIR}/alphavantage-currency.patch"
)
src_test() {
if ! has network ${DIST_TEST_OVERRIDE:-${DIST_TEST:-do parallel}}; then
einfo "Disabling network tests without DIST_TEST_OVERRIDE=~network"
else
export ONLINE_TEST=1
fi
perl-module_src_test
}
mydoc=("Documentation/*")
src_install() {
dodoc -r htdocs
perl-module_src_install
}

View file

@ -0,0 +1,5 @@
AUX alphavantage-currency.patch 1399 BLAKE2B a147a100d2432a7dc01c93a19871897c7cc55bd98ba17331029fadd3feae56feebce4fb34b9c68c9e2fc1c8171aa3b0d85622db50ff7b6ccc3376f572054c343 SHA512 021d3e575258a67fb9d387d3dd486c72d42b8f9a8462738bcfc47888e2771df2e748973d457c1e14e9db74a92ff8ed5b46139f7f5b94968c02091b2fa58baf5e
DIST Finance-Quote-1.52.tar.gz 242120 BLAKE2B 4673de9db498a78eabf8e833b4d50ed2b981150d10d53fde2c17498843a43e5d5603efb8d8aad5aeff3957aa30fcd9bf4f6597fe05deebbea5d5b691c62f51f1 SHA512 1d0198bd4972e7e81886591d262419fae7e5a9e1b0ac45850d9ac862c6b6dab9e08ed6ad8b3cecc437fee0331f558ebc15d9cb3636f78c932bbdb004cef0905b
EBUILD Finance-Quote-1.520.0.ebuild 1752 BLAKE2B 376258998b9ebe9bb60601f1dbeeccc1aea3467a23c7aee3d2b6f9d34b6a72a40fbb703c55d134c3aa153ab5c30bf3780511ef9c23428681837155cc0c9aab8d SHA512 025330d765e47e144788489ad5d578d3364260f7db638dbd0e23b12a84093c4852a6f691d64cf654f845da08473debf9f0f8cf4e594b0f7d0718893fc23ae323
MISC ChangeLog 234 BLAKE2B 28cd284f66688f99ebd7b19f11d00e77d9a5396db184ba807731013b8f621175adbb6db181e5f151e0c1f23814b3a9bfd9068346c532799b1be41e774540e8d7 SHA512 c240c7e3d1adcc30c72efffb210f25ce767dd19750105e5fc65fb32ea0d1ba6c30a15803c23cbf8401a083985cf6c654feaf25185b87725a327ddb527f2b9be4
MISC metadata.xml 4378 BLAKE2B 9e58d3411c53ec5dee267eed278f7bfe1cc19c4fe4a6d49138db09108efb98388b9d93f8aa4d2826a83812eed055b744360abbb4040a793acc9d63b07d815db1 SHA512 f58365ec28214486376ef74fc379f7cbfdf3ba8f186975ab8c5714b445174b573545bf23a5c4423dec40ead2a7a7bb1aac5fe4fa6d2a94d83bed3199e071ad0d

View file

@ -0,0 +1,41 @@
diff --git a/lib/Finance/Quote/CurrencyRates/AlphaVantage.pm b/lib/Finance/Quote/CurrencyRates/AlphaVantage.pm
index b6c4d7f..47b9393 100644
--- a/lib/Finance/Quote/CurrencyRates/AlphaVantage.pm
+++ b/lib/Finance/Quote/CurrencyRates/AlphaVantage.pm
@@ -53,14 +53,15 @@ sub multipliers
{
my ($this, $ua, $from, $to) = @_;
- my $url = 'https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE';
+ my $url = 'https://www.alphavantage.co/query?function=FX_DAILY';
my $try_cnt = 0;
my $json_data;
+ my $rate;
do {
$try_cnt += 1;
my $reply = $ua->get($url
- . '&from_currency=' . ${from}
- . '&to_currency=' . ${to}
+ . '&from_symbol=' . ${from}
+ . '&to_symbol=' . ${to}
. '&apikey=' . $this->{API_KEY});
return unless ($reply->code == 200);
@@ -77,7 +78,16 @@ sub multipliers
sleep (20) if (($try_cnt < 5) && ($json_data->{'Note'}));
} while (($try_cnt < 5) && ($json_data->{'Note'}));
- my $rate = $json_data->{'Realtime Currency Exchange Rate'}->{'5. Exchange Rate'};
+ if( !$json_data->{'Time Series FX (Daily)'} ) {
+ ### No data in JSON
+ $rate = 0.0;
+ } else {
+ my $target = substr($json_data->{'Meta Data'}->{'5. Last Refreshed'}, 0, 10);
+ $rate =
+ $json_data->{'Time Series FX (Daily)'}->{target}->{'4. close'};
+ }
+
+ ### Rate from JSON: $rate
return unless $rate + 0;

View file

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>perl@gentoo.org</email>
<name>Gentoo Perl Project</name>
</maintainer>
<upstream>
<remote-id type="cpan">Finance-Quote</remote-id>
<remote-id type="cpan-module">Finance::Quote</remote-id>
<remote-id type="cpan-module">Finance::Quote::AEX</remote-id>
<remote-id type="cpan-module">Finance::Quote::AIAHK</remote-id>
<remote-id type="cpan-module">Finance::Quote::ASEGR</remote-id>
<remote-id type="cpan-module">Finance::Quote::ASX</remote-id>
<remote-id type="cpan-module">Finance::Quote::AlphaVantage</remote-id>
<remote-id type="cpan-module">Finance::Quote::BMONesbittBurns</remote-id>
<remote-id type="cpan-module">Finance::Quote::BSERO</remote-id>
<remote-id type="cpan-module">Finance::Quote::Bourso</remote-id>
<remote-id type="cpan-module">Finance::Quote::CSE</remote-id>
<remote-id type="cpan-module">Finance::Quote::Cdnfundlibrary</remote-id>
<remote-id type="cpan-module">Finance::Quote::Citywire</remote-id>
<remote-id type="cpan-module">Finance::Quote::Cominvest</remote-id>
<remote-id type="cpan-module">Finance::Quote::Currencies</remote-id>
<remote-id type="cpan-module">Finance::Quote::DWS</remote-id>
<remote-id type="cpan-module">Finance::Quote::Deka</remote-id>
<remote-id type="cpan-module">Finance::Quote::FTPortfolios</remote-id>
<remote-id type="cpan-module">Finance::Quote::FTfunds</remote-id>
<remote-id type="cpan-module">Finance::Quote::Fidelity</remote-id>
<remote-id type="cpan-module">Finance::Quote::FidelityFixed</remote-id>
<remote-id type="cpan-module">Finance::Quote::FinanceCanada</remote-id>
<remote-id type="cpan-module">Finance::Quote::Finanzpartner</remote-id>
<remote-id type="cpan-module">Finance::Quote::Fool</remote-id>
<remote-id type="cpan-module">Finance::Quote::GoldMoney</remote-id>
<remote-id type="cpan-module">Finance::Quote::HEX</remote-id>
<remote-id type="cpan-module">Finance::Quote::HU</remote-id>
<remote-id type="cpan-module">Finance::Quote::IEXCloud</remote-id>
<remote-id type="cpan-module">Finance::Quote::IndiaMutual</remote-id>
<remote-id type="cpan-module">Finance::Quote::LeRevenu</remote-id>
<remote-id type="cpan-module">Finance::Quote::MStaruk</remote-id>
<remote-id type="cpan-module">Finance::Quote::ManInvestments</remote-id>
<remote-id type="cpan-module">Finance::Quote::Morningstar</remote-id>
<remote-id type="cpan-module">Finance::Quote::MorningstarAU</remote-id>
<remote-id type="cpan-module">Finance::Quote::MorningstarCH</remote-id>
<remote-id type="cpan-module">Finance::Quote::MorningstarJP</remote-id>
<remote-id type="cpan-module">Finance::Quote::NZX</remote-id>
<remote-id type="cpan-module">Finance::Quote::Platinum</remote-id>
<remote-id type="cpan-module">Finance::Quote::SEB</remote-id>
<remote-id type="cpan-module">Finance::Quote::SIXfunds</remote-id>
<remote-id type="cpan-module">Finance::Quote::SIXshares</remote-id>
<remote-id type="cpan-module">Finance::Quote::StockHouseCanada</remote-id>
<remote-id type="cpan-module">Finance::Quote::TNetuk</remote-id>
<remote-id type="cpan-module">Finance::Quote::TSP</remote-id>
<remote-id type="cpan-module">Finance::Quote::TSX</remote-id>
<remote-id type="cpan-module">Finance::Quote::Tdefunds</remote-id>
<remote-id type="cpan-module">Finance::Quote::Tdwaterhouse</remote-id>
<remote-id type="cpan-module">Finance::Quote::Tiaacref</remote-id>
<remote-id type="cpan-module">Finance::Quote::Troweprice</remote-id>
<remote-id type="cpan-module">Finance::Quote::Trustnet</remote-id>
<remote-id type="cpan-module">Finance::Quote::USFedBonds</remote-id>
<remote-id type="cpan-module">Finance::Quote::Union</remote-id>
<remote-id type="cpan-module">Finance::Quote::UserAgent</remote-id>
<remote-id type="cpan-module">Finance::Quote::VWD</remote-id>
<remote-id type="cpan-module">Finance::Quote::YahooJSON</remote-id>
<remote-id type="cpan-module">Finance::Quote::YahooYQL</remote-id>
<remote-id type="cpan-module">Finance::Quote::ZA</remote-id>
<remote-id type="cpan-module">Finance::Quote::ZA_UnitTrusts</remote-id>
</upstream>
</pkgmetadata>