Subject: | Finance::Quote 1.47 AlphaVantage has an API call limit |
Date: | Sat, 18 Aug 2018 22:54:19 -0700 |
To: | bug-Finance-Quote [...] rt.cpan.org |
From: | Kevin Brown <daemonstorm [...] gmail.com> |
A change appears to have been put in place starting right around the
beginning of August 2018 for AlphaVantage's API. Prior to August, GnuCash
could retrieve all 16 stocks I'm monitoring with little to no problem
(occasionally feeds weren't updated at the time I checked). As of Aug 1,
2018 the free API has a call limit of 5/minute. It doesn't return an error,
but instead sends back a result of code 200, and a content of the following
JSON:
'{
"Information": "Thank you for using Alpha Vantage! Please visit
https://www.alphavantage.co/premium/ if you would like to have a higher API
call volume."
}',
This isn't caught by the AlphaVantage fetch function and results in any
calls after the 5th to return the above result. It might be feasible to
check for a return code of 200 and a content that just contains an
"Information" key and if this result occurs, putting the module to sleep
for 60 seconds before continuing. This way if someone has a premium API
key, they'd just keep fetching the quotes and those with just the lowly
free API key won't get errors in other apps, like GnuCash that prevent some
automated updating.