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

Owner: Nobody in particular
Requestors: mark [...]

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

Subject: Fix YahooJSON GBp vs GBP
Download (untitled) / with headers
text/plain 567b
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
--- 2017-11-14 17:31:10.580563231 +0000 +++ 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: [ #123630 ] Fix YahooJSON GBp vs GBP
Date: Mon, 19 Mar 2018 15:45:50 +1100
To: <bug-Finance-Quote [...]>
From: "Chris Good" <goodchris96 [...]>
Download (untitled) / with headers
text/plain 126b
FYI The Pull request to fix this issue is Regards, Chris Good

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to