Putting My Money Where My Mouth Is.
I’m on the job hunt. While I wait to hear back from employers I’ve been killing time applying my data science skills to help me make money in the stock market.
Where did I start?
My friend and I created a database using SQLite to store stock info of companies listed on the S&P 500.
db_url = "sqlite:////content/DIY_Investment_Primer_dev_DB.db"engine = sqlalchemy.create_engine(db_url)connection = engine.connect()
We populated that database with 20 years of data for every company listed on the S&P 500. However, there was some cleaning involved when we first retrieved the data from the API calls. The raw data comes pretty ugly.
The above screen clipping is how the database is populated with the data retrieved from the API calls.
Searching for answers
With our database now populated we could start querying for insights. Our first question we wanted answer was “which dividend paying stocks have increased their dividend payouts the most over the past 20 years?”
We decided to answer that because we reasoned that companies that have been able to increase their dividend payout year over year are most likely to have stable growth. Therefore, when we put our money into those stocks then our money will grow consistently and without much risk.
So to get our answer, we calculated the percent change in dividend payout between each year for each company. Then we got each company’s average percent change over those 20 years and chose the 20 companies with the highest average. That is charted below.
Then we looked at each of those companies individually. So for each of those 20 companies we made a chart that shows a bar graph for each year’s dividend payout per share. On top of that bar graph we then superimposed a line graph that traces the percent change in dividend payout between each year.
Scroll down for all of the 20 charts. I hope you find them useful.
After finishing the analysis and reviewing the charts above, I determined a handful of companies in which I will invest. Here’s my list in no particular order:
- Analog Devices, Inc.
- Iron Mountain Inc.
- Western Union Co.
- Maxim Integrated Products
- Motorola Solutions
- UnitedHealth Group Inc.
- Amerisource Bergen
- State Street Corp.
So there it is. A list of companies to dump my stimulus check into. Of course, if you consider referencing this list you should do your own research because I am not your financial advisor. This is not financial advice and you can (and you probably will) lose money investing in the stock market. Anyway, thanks for reading.
Lastly, here’s the code I wrote to create the charts above: