mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
gnc-fq-dump: Err msg if AlphaVantage API Key is needed but missing
AlphaVantage API Key is needed for all currency quotes and stock quotes with source 'alphavantage' or 'vanguard' or multi sources that include 'alphavantage'
This commit is contained in:
parent
ec08fc1d1a
commit
60da4bd7bf
@ -141,6 +141,25 @@ sub report {
|
||||
}
|
||||
}
|
||||
|
||||
sub chk_api_key {
|
||||
my $exch = $_[0];
|
||||
my $url = " https://wiki.gnucash.org/wiki/Online_Quotes#Source_Alphavantage.2C_US\n";
|
||||
if (($exch eq "currency") || ($exch eq "alphavantage")
|
||||
|| ($exch eq "vanguard")) {
|
||||
die "ERROR: ALPHAVANTAGE_API_KEY *must* be set for currency quotes and \n" .
|
||||
" stock quotes with source 'alphavantage' or 'vanguard'; see\n" . $url
|
||||
unless (defined ($ENV{'ALPHAVANTAGE_API_KEY'}));
|
||||
}
|
||||
if (($exch eq "canada") || ($exch eq "nasdaq")
|
||||
|| ($exch eq "nyse") || ($exch eq "usa")) {
|
||||
printf("WARNING: Multiple Source '%s' will not be able to use alphavantage " .
|
||||
"unless ALPHAVANTAGE_API_KEY is set; see\n%s", $exch, $url)
|
||||
unless (defined ($ENV{'ALPHAVANTAGE_API_KEY'}));
|
||||
}
|
||||
}
|
||||
|
||||
############## end of functions - start mainline #########################
|
||||
|
||||
# Check for and load non-standard modules
|
||||
check_modules ();
|
||||
|
||||
@ -162,6 +181,7 @@ if ($ARGV[0] eq "-v") {
|
||||
}
|
||||
|
||||
my $exchange = shift;
|
||||
chk_api_key ($exchange);
|
||||
if ($exchange eq "currency") {
|
||||
my $from = shift;
|
||||
while ($#ARGV >= 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user