[GNC] Unable to download more than 5 currency exchange rates

Mike Alexander mta at umich.edu
Wed Apr 29 02:29:04 EDT 2020


On 26 Apr 2020, at 4:36, davygc wrote:

> It seems that the quote for exchange rate is not handled by 
> Alphavantage.pm
> and the cause of the problem is the limitation of 5 quote per minute.

This is a bug in Finance::Quote which I fixed some time ago.  My fix was 
merged into the master branch on March 21 and will presumably be in the 
next release of F::Q.  In the meantime you can edit the file 
lib/Finance/Quote.pm (which is where currency quotes are handled) to 
change three occurrences of "Information" to "Note" around line 277.  
The patch is

	--- a/lib/Finance/Quote.pm
	+++ b/lib/Finance/Quote.pm
	@@ -274,9 +274,9 @@ sub currency {
		 if ( !$json_data || $json_data->{'Error Message'} ) {
		   return undef;
		 }
	-#	   print "Failed: " . $json_data->{'Information'} . "\n" if 
(($try_cnt < 5) && ($json_data->{'Information'}));
	-	 sleep (20) if (($try_cnt < 5) && ($json_data->{'Information'}));
	-  } while (($try_cnt < 5) && ($json_data->{'Information'}));
	+#	   print "Failed: " . $json_data->{'Note'} . "\n" if (($try_cnt < 5) 
&& ($json_data->{'Note'}));
	+	 sleep (20) if (($try_cnt < 5) && ($json_data->{'Note'}));
	+  } while (($try_cnt < 5) && ($json_data->{'Note'}));
	
	   my $exchange_rate = $json_data->{'Realtime Currency Exchange 
Rate'}->{'5. Exchange Rate'};
	



More information about the gnucash-user mailing list