Yahoo Europe quotes problem
David Reiser
dbreiser at earthlink.net
Sat Nov 1 20:09:10 EDT 2008
On Nov 1, 2008, at 6:31 PM, David Reiser wrote:
>
> On Nov 1, 2008, at 2:43 PM, Pete Phillips wrote:
>
>> Hi
>>
>> I am trying to get automatic updates with gnucash for New Star
>> Technologies from Yahoo Europe.
>>
>> The following perl script gets the quote OK for me:
>>
>> #!/usr/bin/perl -w
>> use Finance::Quote;
>> $q = Finance::Quote->new;
>> my %data = $q->fetch("europe", "GB0007018194GBP");
>> print "Price : ".$data{"GB0007018194GBP", "price"};
>>
>> which returns
>>
>> Price : 712.82#
>>
>> However, in gnucash, with Symbol/Abbreviation GB0007018194GBP and
>> source
>> set to Yahoo Europe I get:
>>
>> Unable to retrieve quotes for these items:
>> FUND:GB0007018194GBP
>>
>> I did pick up the debian package for libfinance-quote-perl (1.13-4)
>> as I
>> read something on the mailing list about problems with Yahoo, but it
>> doesn't seem to have made any difference.
>>
>> Any advice on where I can go next on this would be much appreciated!
>
>
> Based on the response I've received from
> http://rt.cpan.org/Public/Bug/Display.html?id=40169
> I'd say that the newest finance-quote maintainer is interested in
> solving the problem. It might even happen in a week or two.
>
> The patch I posted in that thread results in a supposedly valid quote
> for gnucash, but f-q isn't recognizing the GBp as pence, so the quote
> passed to gnucash is 100x the real value. I think a recent patch in f-
> q stomped on the logic in Base.pm that handled that correctly in prior
> versions. But I haven't verified that yet.
OK. I figured out why the fund quotes weren't getting scaled from
pence to pounds (the exchange can't really be set for the fund
symbols, so the quote won't trigger the code that's already there).
So I did a quick and dirty hack that works for me for European fund
quotes using ISIN-based symbols (i.e., the ISIN followed by the 3-
letter currency), normal London exchange stock quotes, and Yahoo US
based quotes.
If you're feeling adventurous, and don't want to wait for finance-
quote real programmers to fix this the right way, you could apply the
attached patch to the Yahoo modules in Finance-Quote 1.15.
If you test with 'gnc-fq-dump -v europe $symbol' you'll notice that
yahoo europe will always complain about an error. That's because they
have screwed up the Fields and Responses. My patch shuffles fields
around so that the errors occur after all the data you need is already
available to finance-quote for each security.
Inside gnucash, the modified f-q 1.15 retrieves the quotes without
complaint, and seems to get the right numbers, at least for GB funds.
I'm not a programmer, but I can copy and paste semi-intelligently.
Dave
--
David Reiser
dbreiser at earthlink.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fqyahoo2.patch
Type: application/octet-stream
Size: 2390 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-user/attachments/20081101/ba80340e/attachment.obj
-------------- next part --------------
More information about the gnucash-user
mailing list