Python Packages for Investing Analysis (2024)

Discuss all general (i.e. non-personal) investing questions and issues, investing news, and theory.
Post Reply
Topic Author
monkeytoad
Posts: 115
Joined: Sat Apr 06, 2024 11:16 am

Python Packages for Investing Analysis (2024)

Post by monkeytoad »

Hi Bogleheads,

Sometimes some analysis on one's portfolio needs to be done, e.g., in order to check skew relative to the desired AA, check whether to switch between funds https://www.bogleheads.org/wiki/Paying_ ... itch_funds, etc.

It's possible to do this via spreadsheets and something like Excel (which obviously is a very valid choice), but I'd rather use Python:
1. I have layers of different basis costs, and it's cumbersome to feed the different layers to the (excellent) Excel sheets provided here.
2. Different brokerages have different export formats, and it's just easier for me to use Python to ingest them to a uniform structure.

If you use Python for investment maintenance, which packages do you recommend (e.g., for good coverage and detail on historical data)? Please note that open-source packages are built and get broken over time. This is a question for 2024. Many thanks!
Last edited by monkeytoad on Tue Jun 11, 2024 6:21 am, edited 1 time in total.
Just trying to stay the course
exodusing
Posts: 2469
Joined: Thu Oct 13, 2022 7:32 am

Re: Python Packages for Investing Analysis

Post by exodusing »

The most popular package for stock data is probably yfinance. Beyond that what do you need other than whatever you're using to read and write to your spreadsheets (e.g., openpyxl) and to do basic math?

You might search this site for "python" to see what others have been doing.
Topic Author
monkeytoad
Posts: 115
Joined: Sat Apr 06, 2024 11:16 am

Re: Python Packages for Investing Analysis

Post by monkeytoad »

exodusing wrote: Tue Jun 11, 2024 5:29 am The most popular package for stock data is probably yfinance.
Many thanks! yfinance is certainly looking the best, at this point. I appreciate it.

Image
exodusing wrote: Tue Jun 11, 2024 5:29 am Beyond that what do you need other than whatever you're using to read and write to your spreadsheets (e.g., openpyxl) and to do basic math?
E.g., I just got out of a Merril account with 40 ETFs, and am considering which and how much to convert to VTI / VXUS. Each ETF has layers with different cost basis, some are new capital gains and some are old, etc. I have to automate this somehow.
exodusing wrote: Tue Jun 11, 2024 5:29 am You might search this site for "python" to see what others have been doing.
Thanks! I should add that some of the older threads are referencing things which aren't up to date (much as this thread won't be in some time).
Just trying to stay the course
Post Reply