Thanks for that. I think that the coding should work but there is probably an 
error on the Yahoo data where they probably identify the currency as GBP not as 
GBp. I am wondering if all the UK LSE stocks are quoted in pence but the 
currency identifier is sometimes incorrect - in which case it would be better 
to just use the first two letters "GB" to identify which stocks should be 
divided by 100?
 Could I test this by just changing the line:

 if ( ($info{$stocks,"currency"} eq "GBp")

To use a wild card instead of the "p"? Or is there a way to just test the first 
two characters?



________________________________
From: Kalpesh Patel <kalpesh.pa...@usa.net>
Sent: 02 March 2025 17:53
To: 'Adrian Holbrook' <megagru...@hotmail.com>; gnucash-user@gnucash.org 
<gnucash-user@gnucash.org>
Subject: RE: [GNC] Finance::Quote sometimes returns stock prices in pence

>From the latest code you can wrap lines 229 through 234 with following
Perl's if condition clause to bypass the conversion :

if  (!( (uc($stocks) eq "NXR.L") or (uc($stocks) eq "NWG.L") )) {
 ... # actual lines 229 through 234 goes here
}


-----Original Message-----
From: Adrian Holbrook <megagru...@hotmail.com>
Sent: Sunday, March 02, 2025 7:04 AM
To: gnucash-user@gnucash.org
Subject: [GNC] Finance::Quote sometimes returns stock prices in pence

There is a feature in YahooJSON.pm to convert quotes on the LSE in pence to
pounds by dividing by 100. This works on the majority of quotes  but there
are some that it does not work on such as NWG.L (Natwest) and NXR.L
(Norcross). Looking at the file it appears that the division by 100 is
applied if the stock currency is identified as GBp or GBX and then the
currency is changed to GBP as well. So I assume that the currency on Yahoo
is incorrectly identified as GBP for the two stocks above. I am not sure how
to check this but if anyone can suggest a mod to correct it I would be
grateful.

Regards

adrian


_______________________________________________
gnucash-user mailing list
gnucash-user@gnucash.org
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
-----
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.

Reply via email to