Skip Menu |

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

Report information
The Basics
Id: 123630
Status: open
Priority: 0/
Queue: Finance-Quote

People
Owner: Nobody in particular
Requestors: mark [...] awe.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 1.46
  • 1.47
Fixed in: (no value)



Subject: Fix YahooJSON GBp vs GBP
Stock quotes on London exchanges return values in pence not pounds and use the identifier GBp instead of GBP. The old Yahoo module, as well as other modules, have hacks to switch GBp to GBP quotes. In theory it should be the caller doing this, but in practice they don't, and things like GnuCash see GBp and think GBP. This means when you upgrade to 1.46 and switch your quotes from "yahoo" to "yahoo_json" you end up with incorrect prices. The attached patch does the same hack as elsewhere and converts GBp (or GBX if Yahoo ever returns that instead) to GBP.
Subject: gbp-pence-patch.diff
--- YahooJSON.pm.orig 2017-11-14 17:31:10.580563231 +0000 +++ YahooJSON.pm 2017-11-14 17:30:02.301527789 +0000 @@ -126,6 +126,19 @@ $info{ $stocks, "currency"} = $json_resources->{'currency'}; $info{ $stocks, "volume" } = $json_volume; + # The Yahoo JSON interface returns London prices in GBp (pence) instead of GBP (pounds) + # and the Yahoo Base had a hack to convert them to GBP. In theory all the callers + # would correctly handle GBp as not the same as GBP, but they don't, and since + # we had the hack before, let's add it back now. + # + # Convert GBp or GBX to GBP (divide price by 100). + + if ( ($info{$stocks,"currency"} eq "GBp") || + ($info{$stocks,"currency"} eq "GBX")) { + $info{$stocks,"last"}=$info{$stocks,"last"}/100; + $info{ $stocks, "currency"} = "GBP"; + } + $my_date = localtime($json_timestamp)->strftime('%d.%m.%Y %T'); $quoter->store_date( \%info, $stocks,
Subject: [rt.cpan.org #123630 ] Fix YahooJSON GBp vs GBP
Date: Mon, 19 Mar 2018 15:45:50 +1100
To: <bug-Finance-Quote [...] rt.cpan.org>
From: "Chris Good" <goodchris96 [...] gmail.com>
FYI The Pull request to fix this issue is https://github.com/finance-quote/finance-quote/pull/70 Regards, Chris Good