Package: libfinance-quote-perl
Version: 1.13-2
Severity: normal
Tags: patch

Hi,

Since about January 2008, gnucash fails to download stock quotes for
UK Unit Trusts from Yahoo Europe (using libfinance-quote-perl)

I found a bug report for upstream at:
http://sourceforge.net/tracker/index.php?func=detail&aid=1838162&group_id=4232&atid=104232
and a patch at:
http://sourceforge.net/tracker/index.php?func=detail&aid=1910138&group_id=4232&atid=104232
It's not clear from the bug reports, but the patch is for:
/usr/share/perl5/Finance/Quote/Yahoo/Base.pm

The patch fixes the problem for me.

Regards,

Neil



-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (101, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.24-1-686 (SMP w/1 CPU core)
Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages libfinance-quote-perl depends on:
ii  libcrypt-ssleay-perl          0.57-1     Support for https protocol in LWP
ii  libhtml-tableextract-perl     2.10-3     module for extracting the content 
ii  libwww-perl                   5.812-1    WWW client/server library for Perl
ii  perl                          5.8.8-12   Larry Wall's Practical Extraction 

libfinance-quote-perl recommends no packages.

-- no debconf information
--- /usr/share/perl5/Finance/Quote/Yahoo/Base.pm.bak    2007-12-16 
12:27:13.000000000 +0000
+++ /usr/share/perl5/Finance/Quote/Yahoo/Base.pm        2008-03-08 
16:02:04.000000000 +0000
@@ -56,7 +56,7 @@
 # in the URL.  These are recorded below, along with their corresponding
 # field names.
 
[EMAIL PROTECTED] = qw/symbol name last date time net p_change volume bid ask
[EMAIL PROTECTED] = qw/symbol name last time date net p_change volume bid ask
              close open day_range year_range eps pe div_date div div_yield
             cap ex_div avg_vol currency/;
 
@@ -142,7 +142,7 @@
 # yahoo_request (restricted function)
 #
 # This function expects a Finance::Quote object, a base URL to use,
-# a refernece to a list of symbols to lookup.  If a fourth argument is
+# a reference to a list of symbols to lookup.  If a fourth argument is
 # used then it will act as a suffix that needs to be appended to the stocks
 # in order to obtain the correct information.  This function relies upon 
 # the fact that the various Yahoo's all work the same way.
@@ -189,12 +189,21 @@
                                @q = $quoter->parse_csv($_);
                        }
                        my $symbol = $q[0];
+                       $symbol =~ s/GBP$/.L/;
                        my ($exchange) = $symbol =~ m/\.([A-Z]+)/;
 
                        # Strip out suffixes.  Mmmm, functions as lvalues.
                        substr($symbol,-length($suffix),length($suffix)) = "";
 
-                       # If we weren't using a two dimesonal
+                       # Some Yahoo Europe quotes have an N/A field before
+                       # the date.  Check for this and drop the N/A if it is
+                       # there and the date is valid.
+
+                       if($q[3] eq "N/A" && $q[4] =~ m/[0-9]+:[0-9]{2}[AP]M/) {
+                               splice(@q,3,1);
+                       }
+
+                       # If we weren't using a two dimensional
                        # hash, we could do the following with
                        # a hash-slice.  Alas, we can't.  This just
                        # loads all the returned fields into our hash.
@@ -245,6 +254,8 @@
                          # backward compatability.  Needed because Yahoo
                          # returns GBP as GBp.  There may be others.
                          $info{$symbol,"currency"} =~ tr/a-z/A-Z/;
+                         # Remove spaces from currency.
+                         $info{$symbol,"currency"} =~ s/ //;
 #                        printf "Currency %s specified by Yahoo\n", 
$info{$symbol,"currency"};
                        } else {
                          # Determine the currency from the exchange name.
@@ -265,7 +276,7 @@
                        # return in pence. We'd like them to return in pounds
                        # (divide by 100).
                        if (defined($exchange)) {
-                         if (($exchange eq "L"  && $info{$symbol,"currency"} 
eq "GBP") ||
+                         if ((($exchange eq "L" || $exchange eq "MF") && 
$info{$symbol,"currency"} eq "GBP") ||
                              ($exchange eq "TA")) {
                            foreach my $field 
($quoter->default_currency_fields) {
                              next unless ($info{$symbol,$field});

Reply via email to