Adding UK CPI data

Hi - the UK CPI inflation data is accessible on the ONS
eg at
https://api.beta.ons.gov.uk/v1/datasets/cpih01/editions/time-series/versions/4/observations?time=*&geography=K02000001&aggregate=cpih1dim1G100000

Can anyone share how to make a benchmark security based on this data?

thanks

Well, basically PP is able to read a JSON source, if a value as quote and a date is present. Unfortunately the given source does not have a fully qualified date within. So personally I don’t see any chance. Sorry.

given source does not have a fully qualified date within

thanks
yes - suprising that it has non standard date …
I’ll look around further for a better source.

historical HICP inflation United Kingdom
https://www.global-rates.com/highchart-api/?minticks=0000000000001&maxticks=2147410800000&series[0].id=34&series[0].type=9&extra=null

historical CPI inflation United Kingdom
https://www.global-rates.com/highchart-api/?minticks=0000000000001&maxticks=2147410800000&series[0].id=60&series[0].type=9&extra=null

minticks=0000000000001 because PP don’t understand negativ ticks

maxticks=2147410800000 because I think Monday, 18. January 2038 07:00:00 is for a longer working URL, greater values are not OK (timestamp overflow)

2 Likes

Cool :slight_smile:

So, maybe better to use

minticks={TODAY:unixtime:-P50Y}000          (one-time use)
minticks={TODAY:unixtime:-P6M}000
maxticks={TODAY:unixtime}000

Haven’t tested it yet, but I think the macro provides the timestamp in seconds, not milliseconds, hence the three zeros at the end.

EDIT: Now I’ve tested it, works like a charm

https://www.global-rates.com/highchart-api/?minticks={TODAY:unixtime:-P6M}000&maxticks={TODAY:unixtime}000&series[0].id=60&series[0].type=9&extra=null

$[0].data[*][0]

$[0].data[*][1]

1 Like

thats great… thanks
it look interesting, What I would like to do now is mimic for the uk the same as the pp built-in security for CPI (HICP which is no longer upto date for the UK since brexit)… which rather than a percentage inflation figure shows the inflation value on 100 units of currency over some time frame (usually from 2015) so that the performance of a security can be compared to inflation over the same period… if that makes sense.
thanks again