Fund Manager
PORTFOLIO MANAGEMENT SOFTWARE
Contact Us

Is there a server that provides CPI data?

Questions about updating prices or transactions in Fund Manager

Postby rdr713 » Sun May 12, 2024 1:45 pm

I'd like to automatically download Consumer Price Index data. Does anyone know of a server that provides it?

I'm NOT talking about the current inflation rate but the actual index numbers; the current index, for instance is just over 312 (1982-84=100). From an older thread on this forum I learned that year-over-year changes in the CPI are available on the Stooq server. This is useful but not what I'm looking for.
rdr713
 
Posts: 4
Joined: Fri Aug 26, 2016 12:54 pm

Postby Mark » Mon May 13, 2024 8:37 am

Hi rdr713,

Sorry, I'm not aware of any source for this type of data, but that doesn't mean it isn't available on one of our supported servers.
Thanks,
Mark
Fund Manager - Portfolio Management Software
Mark
Site Admin
 
Posts: 11586
Joined: Thu Oct 25, 2007 2:24 pm
Location: Chandler, AZ

Postby quercus » Thu May 16, 2024 5:45 am

I haven't found a ticker that would let you get something like CPI-U from a Fund Manager quote server.

But in case anyone reading this is motivated to get into the weeds, the official data source is the Bureau of Labor Statistics. They have a CPI data series in various flavors, and have an API with code examples. Or lower tech, they maintain links with the data in txt, xlsx, etc.

https://www.bls.gov/data/

https://www.bls.gov/developers/home.htm
quercus
 
Posts: 23
Joined: Fri May 09, 2008 11:03 pm

Postby ballardian » Sat Aug 24, 2024 11:21 pm

I know this is A) old post and B) I don't know of any tickers / servers to download CPI from.

However, I was bored and spent maybe an hour? putting together a powershell script that can do this for you from the API.

To use you will need to use powershell (I recommend the Powershell ISE) and enable running scripts (Set-ExecutionPolicy option). Then download the script and rename it it .ps1 from .txt

When you run the script it will ask you what series of data you want to download -- I've included the 3 most popular CPI options I could find and you can add your own. It will ask what end year data you want to download and then how many years prior. The free API only allows 10 years max so that is all you can select.

It will download the data, convert it from JSON, and reformat it for FM, and spit out a csv with the data in it in the same folder you ran the script from.

Then import the prices into using the generic import option with the following format:

SYMB,MM,DD,YY,NAV

The SYMB is the series name the BLS uses.

To use I'd buy one share of the ticker and then import the 'prices' of CPI

Not as elegant as an internal quote server to download from but more convenient then manually looking it up and entering it. And in theory you can run ~10 - 10 year blocks and get all the historical data.

Just beware the free API only allows you to run it 25 times a day :)
Attachments
CPI-DL.txt
(2.61 KiB) Downloaded 53 times
ballardian
 
Posts: 44
Joined: Tue Sep 21, 2010 7:52 pm

Postby ballardian » Sun Aug 25, 2024 11:08 am

Version 2

To run it the requirments are the same as v1

The major changes are now you only have 2 options for time frame:

All years
Last 3 Years

If you choose all years it will automatically chunk the data into 10 year chunks and run the download however many times it needs to run to get all the data up to this year.

If you choose the last 3 years you get this year + the 2 former years. It isn't 36 months it is really max 3 years if you run it in December. Otherwise it is 2 years + months to date.

That should make it easier to use both as initial seed and ongoing.

Limitations: The start year is hard coded for CPI-U data. If you want to use a series that has a different start date in the data series you may need to edit it or it may act funny when downloading. I haven't tested it.

Disclaimer for both: No guarantees the data is correct etc. Use at your own risk.

Overall it was a fun little project to play with
Attachments
CPI-DLv2.txt
(3.91 KiB) Downloaded 49 times
ballardian
 
Posts: 44
Joined: Tue Sep 21, 2010 7:52 pm

Postby ballardian » Sun Aug 25, 2024 11:15 am

Also hat tip to quercus for the API link that got me playing with it and also rdr713 for starting the question
ballardian
 
Posts: 44
Joined: Tue Sep 21, 2010 7:52 pm


Return to Prices and Transactions

Who is online

Users browsing this forum: No registered users and 13 guests

FundManagerSoftware.com | Search | Site Map | About Us | Privacy Policy
Copyright © 1993-2024 Beiley Software, Inc. All rights reserved.
cron