Problem with home-made Finance::Quote script

Fredrik Persson fredrik.p.persson at gmail.com
Tue Nov 4 14:27:48 EST 2008


Very interesting, thank you. I'm using Finance::Quote 1.13, which is
default in Ubuntu 8.10. I'll try to upgrade.

This beeing *funds*, a time in hours, minutes and seconds has no
meaning, since the NAV is calculated only once every business day.
Therefore, a default time supplied by gnucash is very useful. Otherwise,
the finance-quote scripts for funds would have to supply a dummy
timestamp of some kind.

I'm still curious about what makes my script appear among the "unknown"
ones and not the "single" ones in "Edit Security" though...

Thanks again!

/Fredrik Persson

On Tue, 2008-11-04 at 14:10 -0500, Dave Reiser wrote:
> 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
> 



More information about the gnucash-devel mailing list