Fetching CPI data from open data sources such as SCB

If using index linked bonds with dependency on monthly published CPI you might have encountered the problem with automation as monthly data may be hard to pull from sources such as Bloomberg and Refinitiv.

Here is a simple piece of code and a sample workspace that:

  1. can connect to SCB open data api and request CPI series
  2. take json file to local disc and convert to csv if needed
  3. write the data directly to your quantlab’s database table for CPI storage
  4. show results in a local workspace table

The code can be adapted to run in a QLB batch server process so it can be scheduled and automated. This code is simplified a bit.

Acknowledgements to @Janne for assisting with the json creation and parsing.
SEK CPI from SCB.qlw (21.3 KB)

2 Likes