Skip Menu |

This queue is for tickets about the Finance-Quote CPAN distribution.

Report information
The Basics
Id: 44245
Status: resolved
Worked: 15 min
Priority: 0/
Queue: Finance-Quote

People
Owner: eco [...] ecocode.net
Requestors: lmamane-bitcard [...] conuropsis.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.15
Fixed in: (no value)



Subject: yahoo_europe regression on mutual funds
I'm using Debian, but I have disabled all Debian patches and the problem still occurs. The yahoo_europe returns wrong data (the right data, but in the wrong fields) for at least some mutual funds. My test case is INGBM.AS. My test program is: use Finance::Quote; use Data::Dumper; my $q = Finance::Quote->new(); my %data = $q->fetch('yahoo_europe', 'INGBM.AS'); print Dumper( {%data} ); Output with 1.15: 'INGBM.ASnet' => '03/17/2009', 'INGBM.ASlast' => '29.83', 'INGBM.ASname' => 'IBP ING BASIC MAT 6', 'INGBM.AStime' => '00:00', 'INGBM.ASisodate' => '2000-00-00', 'INGBM.ASopen' => '29.44', 'INGBM.ASsuccess' => 1, 'INGBM.ASvolume' => '+1.32%', 'INGBM.ASprice' => '29.83', 'INGBM.ASdate' => '00/00/2000', 'INGBM.ASp_change' => '+0.39', 'INGBM.ASmethod' => 'yahoo_europe', 'INGBM.ASsymbol' => 'INGBM.AS', 'INGBM.AScap' => '0.00' In particular: - currency is undef, which makes it unusable by Gnucash - p_change contains a net change, should contain percent - net is undef - volume contains what should be p_change There is more detail at http://bugs.debian.org/517626.
RT-Send-CC: 517626 [...] bugs.debian.org
Here is a patch that fixes this problem; I've tested it with yahoo and yahoo_asia, it works, too.
diff -u --recursive libfinance-quote-perl-1.15/lib/Finance/Quote/Yahoo/Base.pm /usr/share/perl5/Finance/Quote/Yahoo/Base.pm --- libfinance-quote-perl-1.15/lib/Finance/Quote/Yahoo/Base.pm 2008-10-26 09:15:50.000000000 +0100 +++ /usr/share/perl5/Finance/Quote/Yahoo/Base.pm 2009-03-17 16:55:52.849536735 +0100 @@ -56,11 +56,11 @@ # in the URL. These are recorded below, along with their corresponding # field names. -@FIELDS = qw/symbol name last date time net p_change volume bid ask +@FIELDS = qw/symbol name last 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/; + cap ex_div avg_vol currency time date/; -@FIELD_ENCODING = qw/s n l1 d1 t1 c1 p2 v b a p o m w e r r1 d y j1 q a2 c4/; +@FIELD_ENCODING = qw/s n l1 c1 p2 v b a p o m w e r r1 d y j1 q a2 c4 t1 d1/; # This returns a list of labels that are provided, so that code # that make use of this module can know what it's dealing with. @@ -156,7 +156,7 @@ # The suffix is used to specify particular markets. my $suffix = shift || ""; - + my $uses_semicolon = shift || 0; my %info; Only in /usr/share/perl5/Finance/Quote/Yahoo/: Base.pm~ diff -u --recursive libfinance-quote-perl-1.15/lib/Finance/Quote/Yahoo/Europe.pm /usr/share/perl5/Finance/Quote/Yahoo/Europe.pm --- libfinance-quote-perl-1.15/lib/Finance/Quote/Yahoo/Europe.pm 2008-10-26 09:15:50.000000000 +0100 +++ /usr/share/perl5/Finance/Quote/Yahoo/Europe.pm 2009-03-17 16:56:21.921029713 +0100 @@ -42,18 +42,6 @@ $YAHOO_EUROPE_URL = ("http://uk.finance.yahoo.com/d/quotes.csv"); -# Yahoo Europe switched date and time. sending t1d1 or d1t1 -# returns the same : Time followed by date. This is a short -# bug fix until yahoo changes back again. -# -# Yahoo Europe doens't return values for r1 (div_date) and q (ex_div) -# Another solution might be to change Base.pm FIELDS labels to this -# string + div_date and ex_div. Code would be nicier, but this will -# need more testing for other yahoo modules and can be done later. -our @YH_EUROPE_FIELDS = qw/symbol name last time date net p_change volume bid ask - close open day_range year_range eps pe div div_yield - cap avg_vol currency/; - sub methods {return (europe => \&yahoo_europe,yahoo_europe => \&yahoo_europe)}; { @@ -70,10 +58,6 @@ my @symbols = @_; return unless @symbols; # Nothing if no symbols. - # localise the Base.FIELDS array. Perl restores the array at - # the end of this sub. - local @Finance::Quote::Yahoo::Base::FIELDS = @YH_EUROPE_FIELDS ; - # This does all the hard work. my %info = yahoo_request($quoter,$YAHOO_EUROPE_URL,\@symbols); Only in /usr/share/perl5/Finance/Quote/Yahoo/: Europe.pm~
Subject: Bug#517626: Info received ([rt.cpan.org #44245] yahoo_europe regression on mutual funds )
Date: Tue, 17 Mar 2009 16:12:02 +0000
To: bug-Finance-Quote [...] rt.cpan.org
From: owner [...] bugs.debian.org (Debian Bug Tracking System)
Thank you for the additional information you have supplied regarding this Bug report. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): Bart Martens <bartm@debian.org> If you wish to submit further information on this problem, please send it to 517626@bugs.debian.org, as before. Please do not send mail to owner@bugs.debian.org unless you wish to report a problem with the Bug-tracking system. -- 517626: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=517626 Debian Bug Tracking System Contact owner@bugs.debian.org with problems
On Tue Mar 17 12:06:28 2009, lmamane wrote: Show quoted text
> Here is a patch that fixes this problem; I've tested it with yahoo and > yahoo_asia, it works, too.
I had tested it on INGBM.AS. But it breaks e.g. KPN.AS, so this is a no-go. Sigh.
Now, _this_ patch has been tested with symbol/method: - JNPR yahoo - KPN.AS yahoo - KPN.AS yahoo_europe - INGBM.AS yahoo - INGBM.AS yahoo_europe - INGBM.AS yahoo_asia and works with all these combinations.
diff -u --recursive libfinance-quote-perl-1.15/lib/Finance/Quote/Yahoo/Base.pm /usr/share/perl5/Finance/Quote/Yahoo/Base.pm --- libfinance-quote-perl-1.15/lib/Finance/Quote/Yahoo/Base.pm 2008-10-26 09:15:50.000000000 +0100 +++ /usr/share/perl5/Finance/Quote/Yahoo/Base.pm 2009-03-17 18:44:07.637030153 +0100 @@ -56,11 +56,11 @@ # in the URL. These are recorded below, along with their corresponding # field names. -@FIELDS = qw/symbol name last date time 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/; +@FIELDS = qw/symbol name last net p_change volume bid ask + close open day_range year_range eps pe div div_yield + cap avg_vol currency time date ex_div div_date/; -@FIELD_ENCODING = qw/s n l1 d1 t1 c1 p2 v b a p o m w e r r1 d y j1 q a2 c4/; +@FIELD_ENCODING = qw/s n l1 c1 p2 v b a p o m w e r d y j1 a2 c4 t1 d1 q r1/; # This returns a list of labels that are provided, so that code # that make use of this module can know what it's dealing with. diff -u --recursive libfinance-quote-perl-1.15/lib/Finance/Quote/Yahoo/Europe.pm /usr/share/perl5/Finance/Quote/Yahoo/Europe.pm --- libfinance-quote-perl-1.15/lib/Finance/Quote/Yahoo/Europe.pm 2008-10-26 09:15:50.000000000 +0100 +++ /usr/share/perl5/Finance/Quote/Yahoo/Europe.pm 2009-03-17 16:56:21.921029713 +0100 @@ -42,18 +42,6 @@ $YAHOO_EUROPE_URL = ("http://uk.finance.yahoo.com/d/quotes.csv"); -# Yahoo Europe switched date and time. sending t1d1 or d1t1 -# returns the same : Time followed by date. This is a short -# bug fix until yahoo changes back again. -# -# Yahoo Europe doens't return values for r1 (div_date) and q (ex_div) -# Another solution might be to change Base.pm FIELDS labels to this -# string + div_date and ex_div. Code would be nicier, but this will -# need more testing for other yahoo modules and can be done later. -our @YH_EUROPE_FIELDS = qw/symbol name last time date net p_change volume bid ask - close open day_range year_range eps pe div div_yield - cap avg_vol currency/; - sub methods {return (europe => \&yahoo_europe,yahoo_europe => \&yahoo_europe)}; { @@ -70,10 +58,6 @@ my @symbols = @_; return unless @symbols; # Nothing if no symbols. - # localise the Base.FIELDS array. Perl restores the array at - # the end of this sub. - local @Finance::Quote::Yahoo::Base::FIELDS = @YH_EUROPE_FIELDS ; - # This does all the hard work. my %info = yahoo_request($quoter,$YAHOO_EUROPE_URL,\@symbols);
On Tue Mar 17 13:51:14 2009, lmamane wrote: Show quoted text
> Now, _this_ patch has been tested with symbol/method: > > - JNPR yahoo > - KPN.AS yahoo > - KPN.AS yahoo_europe > - INGBM.AS yahoo > - INGBM.AS yahoo_europe > - INGBM.AS yahoo_asia > > and works with all these combinations.
I've modified your patch to work only on yahoo_europe and don't interfere with other yahoo modules. It seems to work here. Will be included in version 1.17 thanks for your code! -- Erik