I am having trouble with what seems like an inconsistency of units with Yahoo Finance API data.
The issue relates to whether I'm getting the current price or historic price. The current price is almost always quoted in GBX (aka. GBp/ or pence) as expected. However, the historic price is quoted in GBP (pounds) for some tickers.
E.g 1: The following work to the same units GBX (note: prices will have minor differences due to date difference):
E.g 2: The following (for a different company, but also LSE) differ by a factor of 100 (note: prices will have minor differences due to date difference):
I then created a program to check how many were like this.
Of approx 1,400 London (.L) tickers on Yahoo Finance:
- Approx 19.5% had the historic price in GBP(!) and the current price in GBX (pence) - e.g.DIG.L
- Approx 0.675% had the current price 100x greater than the correct value - e.g. CZB.L
- Approx 78.39% correctly matched (woo hoo!). - e.g. PFC.L
The remaining approx 1.4% didn't fit my algorithm, but could be explained as one of the above 3 categories when reviewed manually.
So it seems that the current price is nearly always right, but the historic data can be inaccurate.
My question is: 19.5% is a bizarre number to be out. Is there something going on at Yahoo to change the units from pounds to pence for the Historic data, or will I always have to account for this inconsistency?
NOTE: I tried the Yahoo forum a few days ago, but it's almost unused. I'm hoping a StackExchange community will be more active.