Hi Steven,
You can but you should ask the gnucash-user email list first as many other people are interested, may have more available time and may have answers I don’t have. Regards, Chris Good From: Steven Anter <[email protected]> Sent: Monday, 2 April 2018 9:26 AM To: Chris Good <[email protected]>; [email protected] Subject: Re: FW: alphavantage quotes fix Hi Chris, Applied your patches and AlphaVantage worked. For now at least. If I have future issues, may I contact you? <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon> Virus-free. <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link> www.avast.com On Sat, Mar 31, 2018 at 9:49 PM, Chris Good <[email protected] <mailto:[email protected]> > wrote: Hi Steven, Please see my mail below but get the Quote.pm + AlphaVantage.pm from Mike Alexander’s git hub instead of mine as he has also put the 1 second delay between each request for a currency and you will need that. Get from Quote.pm from https://raw.githubusercontent.com/mtalexander/finance-quote/6ee43ea08b504617142139fda41ae45be865fa38/lib/Finance/Quote.pm Get AlphaVantage.pm from https://github.com/mtalexander/finance-quote/blob/6ee43ea08b504617142139fda41ae45be865fa38/lib/Finance/Quote/AlphaVantage.pm Regards, Chris Good From: Chris Good <[email protected] <mailto:[email protected]> > Sent: Sunday, 18 March 2018 6:54 PM To: [email protected] <mailto:[email protected]> Cc: [email protected] <mailto:[email protected]> Subject: RE: alphavantage quotes fix Message: 1 Date: Sat, 3 Mar 2018 07:49:34 -0600 From: Paul Bates <[email protected] <mailto:[email protected]> > To: [email protected] <mailto:[email protected]> Subject: [Finance-quote-devel] alphavantage quotes fix Message-ID: <cal7glafoitanvhwrvtmopy5odnzwgjbdzkfwztusddb4gaj...@mail.gmail.com <mailto:cal7glafoitanvhwrvtmopy5odnzwgjbdzkfwztusddb4gaj...@mail.gmail.com> > Content-Type: text/plain; charset="utf-8" I have been using the alphavantage module with gnucash to get quotes for stocks. The list is well over 40, so it has become nonfunctional in the last couple of months. I am not a perl programmer, so the fix took several hours and more cups of coffee. I hope a perl programmer can add error checks and possibly while loops to catch the occasional double message. Currently It seems to miss one or two stocks on the list. In alphavantage.pm <http://alphavantage.pm> I inserted the following code in the sub alphavantage : my $code = $reply->code; my $desc = HTTP::Status::status_message($code); my $body = $reply->content; if ($code != 200) { $info{ $stock, 'success' } = 0; $info{ $stock, 'errormsg' } = $desc; next; } my $json_data; eval {$json_data = JSON::decode_json $body}; ################################################# ### Insert ################################################# # attempt to handle the Information message if ( $json_data->{'Information'} ) { sleep (20); $reply = $ua->request( GET $url); $code = $reply->code; $desc = HTTP::Status::status_message($code); $body = $reply->content; eval {$json_data = JSON::decode_json $body}; } ################################################### if ($@) { $info{ $stock, 'success' } = 0; $info{ $stock, 'errormsg' } = $@; } I am sure there are better ways to handle this, but I am not used to the developers lists and hate to leave alphavantage being blamed for a problem that is not theirs. Paul Bates Hi Paul, I have modified AlphaVantage.pm as you requested. If it fails with an Information message, it will try again 4 times, with a 20 second delay between each try. It tests OK for me but I don’t usually use AlphaVantage and it has never failed with an Information message for me, so can you please get my code from https://github.com/goodvibes2/finance-quote/blob/FqIss83AlphaVantage/lib/Finance/Quote/AlphaVantage.pm and test it? After you test it, I will create a Pull Request to get this change incorporated in Finance::Quote. Just for completeness, can you tell us what is in the Information messages you are getting? Regards, Chris Good _______________________________________________ gnucash-user mailing list [email protected] To update your subscription preferences or to unsubscribe: https://lists.gnucash.org/mailman/listinfo/gnucash-user If you are using Nabble or Gmane, please see https://wiki.gnucash.org/wiki/Mailing_Lists for more information. ----- Please remember to CC this list on all your replies. You can do this by using Reply-To-List or Reply-All.
