gnucash master: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sat Jun 13 14:09:44 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/b126227a (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f1ff45ec (commit)
	 via  https://github.com/Gnucash/gnucash/commit/60da4bd7 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/ec08fc1d (commit)
	from  https://github.com/Gnucash/gnucash/commit/e972860d (commit)



commit b126227aab634f6e27d1887ec8615c2c9aed0ea8
Merge: e972860de f1ff45eca
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Jun 13 10:35:25 2020 -0700

    Merge Chris Good's 'gnc-fq-dumpMas' into master.

diff --cc gnucash/price-quotes.scm
index c562987e9,c73df2d02..3b6168d11
--- a/gnucash/price-quotes.scm
+++ b/gnucash/price-quotes.scm
@@@ -447,6 -450,11 +450,12 @@@
        (show-error (N_ "You are missing some needed Perl libraries.
  Run 'gnc-fq-update' as root to install them.")))
  
+      ((memq 'need-alphavantage-key fq-results)
+       (set! keep-going? #f)
 -      (show-error (N_ "ERROR: ALPHAVANTAGE_API_KEY must be set for currency \
 -+ quotes; see https://wiki.gnucash.org/wiki/Online_Quotes#Source_Alphavantage.2C_US")))
++      (gnc-error-dialog
++       window (format #f (_ "ERROR: ALPHAVANTAGE_API_KEY must be set for currency and quotes; see ~A")
++                      "https://wiki.gnucash.org/wiki/Online_Quotes#Source_Alphavantage.2C_US")))
+ 
       ((memq 'system-error fq-results)
        (set! keep-going? #f)
        (show-error (N_ "There was a system error while retrieving the price quotes.")))

commit f1ff45ecae16b0468ee4523ed358c2b9874402a9
Author: goodvibes2 <goodchris96 at gmail.com>
Date:   Fri Jun 12 15:20:57 2020 +1000

    Bug 796993 - Get Quotes: Err msg if Alpha Vantage API key needed
    
    AlphaVantage API Key is needed for all currency quotes
    and stock quotes with source 'alphavantage' or 'vanguard' or
    multi sources that include 'alphavantage'.
    Give an error message instead of failing with no reason.

diff --git a/gnucash/price-quotes.scm b/gnucash/price-quotes.scm
index c562987e9..c73df2d02 100644
--- a/gnucash/price-quotes.scm
+++ b/gnucash/price-quotes.scm
@@ -128,6 +128,9 @@
            (catch #t
              (lambda ()
                (gnc:debug "handling-request: " request)
+               (and (member (car request) '("currency" "alphavantage" "vanguard"))
+                    (not (getenv "ALPHAVANTAGE_API_KEY"))
+                    (throw 'need-alphavantage-key))
                ;; we need to display the first element (the method,
                ;; so it won't be quoted) and then write the rest
                (with-output-to-port (fdes->outport (gnc-process-get-fd quoter 0))
@@ -447,6 +450,11 @@
       (show-error (N_ "You are missing some needed Perl libraries.
 Run 'gnc-fq-update' as root to install them.")))
 
+     ((memq 'need-alphavantage-key fq-results)
+      (set! keep-going? #f)
+      (show-error (N_ "ERROR: ALPHAVANTAGE_API_KEY must be set for currency \
++ quotes; see https://wiki.gnucash.org/wiki/Online_Quotes#Source_Alphavantage.2C_US")))
+
      ((memq 'system-error fq-results)
       (set! keep-going? #f)
       (show-error (N_ "There was a system error while retrieving the price quotes.")))

commit 60da4bd7bf5b06cc93a000ed757e22a08554bf4b
Author: goodvibes2 <goodchris96 at gmail.com>
Date:   Fri Jun 12 15:11:53 2020 +1000

    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'

diff --git a/libgnucash/quotes/gnc-fq-dump.in b/libgnucash/quotes/gnc-fq-dump.in
index 6c595a835..6f11f8d82 100755
--- a/libgnucash/quotes/gnc-fq-dump.in
+++ b/libgnucash/quotes/gnc-fq-dump.in
@@ -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) {

commit ec08fc1d1a7a79a4a0cf7d48aeb2cab78a728a3f
Author: goodvibes2 <goodchris96 at gmail.com>
Date:   Fri Jun 12 15:05:53 2020 +1000

    gnc-fq-dump: add examples to synopsis + remove tabs

diff --git a/libgnucash/quotes/gnc-fq-dump.in b/libgnucash/quotes/gnc-fq-dump.in
index ed5aa389d..6c595a835 100755
--- a/libgnucash/quotes/gnc-fq-dump.in
+++ b/libgnucash/quotes/gnc-fq-dump.in
@@ -113,13 +113,13 @@ sub report {
 
   # Dump gnucash recognized fields
   printf "Finance::Quote fields Gnucash uses:\n";
-  printf "    symbol: %-20s <=== required\n",	  $symbol;
+  printf "    symbol: %-20s <=== required\n",     $symbol;
   printf "      date: %-20s <=== recommended\n",  $date;
-  printf "  currency: %-20s <=== required\n", 	  $currency;
-  printf "      last: %-20s <=\\       \n",    	  $last;
+  printf "  currency: %-20s <=== required\n",     $currency;
+  printf "      last: %-20s <=\\       \n",       $last;
   printf "       nav: %-20s <=== one of these\n", $nav;
-  printf "     price: %-20s <=/        \n", 	  $price;
-  printf "  timezone: %-20s <=== optional\n", 	  $timezone;
+  printf "     price: %-20s <=/        \n",       $price;
+  printf "  timezone: %-20s <=== optional\n",     $timezone;
 
   # Report failure
   if ($gccanuse == 0) {
@@ -197,15 +197,20 @@ if ($exchange eq "currency") {
 
 =head1 NAME
 
-gnc-fq-dump	- Print out data from the F::Q module
+gnc-fq-dump - Print out data from the F::Q module
 
 =head1 SYNOPSIS
 
-    gnc-fq-dump alphavantage CSCO JNPR
-    gnc-fq-dump alphavantage BAESY.PK
-    gnc-fq-dump europe 48406.PA 13000.PA
-    gnc-fq-dump vwd 632034
-    gnc-fq-dump ftportfolios FKYGTX
+  Currency Exchange Rates
+    gnc-fq-dump currency USD AUD
+    gnc-fq-dump [-v] yahoo_json USDEUR=X
+  Stock Quotes    
+    gnc-fq-dump [-v] alphavantage CSCO JNPR
+    gnc-fq-dump [-v] alphavantage BAESY.PK
+    gnc-fq-dump [-v] yahoo_json CBA.AX
+    gnc-fq-dump [-v] europe 48406.PA 13000.PA
+    gnc-fq-dump [-v] vwd 632034
+    gnc-fq-dump [-v] ftportfolios FKYGTX
 
 =head1 DESCRIPTION
 



Summary of changes:
 gnucash/price-quotes.scm         |  9 ++++++++
 libgnucash/quotes/gnc-fq-dump.in | 47 ++++++++++++++++++++++++++++++----------
 2 files changed, 45 insertions(+), 11 deletions(-)



More information about the gnucash-changes mailing list