Problem with home-made Finance::Quote script

Dave Reiser dbreiser at earthlink.net
Tue Nov 4 14:10:38 EST 2008


Fredrik Persson wrote:
> I don't understand. Do you mean a time like in 5:45PM, or a date such as
> 2008-11-04? How do I have finance-quote ask for this? I've stolen most
> of the code from the script SEB.pm, included in finance-quote module. My
> script does everything almost exactly the same. Still it doesn't work.
> 
> I've noticed that when I try to use it under gnucash, I find it not
> under "Get Online Quotes -> Single" combobox, but under "Get Online
> Quotes -> Unknown" in the "Edit Security" dialog box. What does this
> mean? 
> 
> I've tried this exact perl script under gnucash 2.2.7 on Windows, and it
> works perfectly. It does not, however, work under Ubuntu and gnucash
> 2.2.6.
> 
> Where in the gnucash code does the rejection of my quote happen?
> 
> Thanks!
> 
> /Fredrik

My guess was based on part of src/quotes/gnc-fq-helper.in:

sub schemify_date {
   # return the date in epoch seconds.
   my ($datestr) = @_;

   my $date = ParseDate($datestr);
   my $result = UnixDate($date, "%s");
   if($result !~ /^(\+|-)?\d+$/) {
     $result = "failed-conversion";
   }
   return("$result");
}

I don't know perl well, but when a bug in finance-quote 1.14 resulted in 
times like "16:000" for end-of-day quotes in the US using yahoo, gnucash 
refused to import the quote, even though 'gnc-fq-dump ...' with no -v 
flag suggested the quote retrieval was correct. Fixing the time parsing 
in f-q fixed the import. f-q 1.15 has fixed this problem.

I have a vague recollection that gnucash can supply a default time, if 
none is supplied by f-q. If so, then my suggestion to you was probably 
off-base.

Dave

-- 
David Reiser
dbreiser at earthlink.net


More information about the gnucash-devel mailing list