Can I Buy My Own Income?

Sean Byrne
4 min readApr 26, 2021

--

Why yes, yes you can.

It feels good carrying a bunch of money

You may have read a previous post of mine where I elaborate on the concept of “F*** you money.” If you haven’t then check it out here, but in this little diddy I’m going to elaborate a little more on that and explain how one can buy their own income.

So I made a little database that contains all the dividend and price info from the past 20 years for all the companies listed on the S&P 500. Let me tell you, it’s a doozy of a database with over 100,000 rows. I populated it by making a bunch of API calls to AlphaVantage.

See. Over a 100,000 rows

This database has been the starting point for the analyses I’ve been providing lately. With it, I’ve gotten some great insight to help me decide into which stocks to dump my money. In this post I’ll share my most recent query of the database where I created a table of the companies that shows which months each company pays their dividend. Now, why would anyone want to know that? Well this is how one would be able to buy their own monthly income. With this table one could create a portfolio that pays them each month of the year because they could just choose companies based on which months they pay a dividend. Of course, you need to do your own due diligence and research before buying any company’s stock. Don’t just choose them based on the months they pay a dividend.

How did I query my database?

In my SQLite database I wrote this nifty query to return a table of all the dividend paying companies in the S&P 500.

The query I wrote to return the table of company dividends organized by month

Below is a snippet of the table that the query returned:

As you can see in the screenshot above, each month is a column and each row shows the dividend per share that a company paid for that month. The one downside to this strategy is you do need at least $100,000 to put into this type of portfolio to get any sort of substantial monthly payout. If you don’t have that amount then it’s important to incorporate a dividend reinvesting strategy to help it grow faster.

So why am I sharing this?

Well, in a world where employers increasingly have more leverage over their employees and job security is evermore fleeting I want to help people create their own financial security net. Having something like this will make the hard times not so hard if one gets laid off or furloughed. While employed a person can just reinvest the dividends paid out each month, which I elaborated on in a previous post. If they get fired or decide to leave their job, they then can use the monthly dividend payments to float them while they search for a new job or go back to school or whatever they decide to do. Also, having this type of portfolio could be the difference in staying at a job that someone hates or walking away from it and finding more fulfilling work.

If you want the full table you can download it for yourself HERE. The link will take you to a google sheets file that you can just copy and download for yourself.

Remember, if you consider referencing this post 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.

Do you want to make your own dataset?

Below is the script of code you can use to make your own dataset of stock info from AlphaVantage. You’ll just need your own API key and a list of companies for which you want data.

allCompany_df = pd.DataFrame([[0, 0, 0, 0,0,0, 0, "0", "0", 0, 0]], columns=['1. open', '2. high', '3. low', '4. close', '5. adjusted close', '6. volume', '7. dividend amount', 'Company_Ticker', 'Company_name', 'month', 'year'])i = 0#for symbol in chunker(lstOFa, 1):for symbol in listOfCompanies:div_monthly_summary = f"https://www.alphavantage.co/query?function=TIME_SERIES_MONTHLY_ADJUSTED&symbol={symbol}&apikey={APIkey}"parsed_divs = json.loads(requests.get(div_monthly_summary).text)### make a row for each date in the 'Monthly Adjusted Time Series' with the### dividend amount as the entry"""div_dates = list(parsed_divs.items())date_cols = list(div_dates[1][1].keys())"""monthly_time_series_df = pd.DataFrame.from_dict(parsed_divs['Monthly Adjusted Time Series'], orient ='index')monthly_time_series_df['Company_ticker'] = symbolmonthly_time_series_df['Company_name'] = trimmedSP500['Security'][i]monthly_time_series_df['month'] = pd.DatetimeIndex(monthly_time_series_df.index).monthmonthly_time_series_df['year'] = pd.DatetimeIndex(monthly_time_series_df.index).yearmonthly_time_series_df.reset_index(drop=True, inplace=True)print(monthly_time_series_df.head(3))allCompany_df = pd.concat([allCompany_df, monthly_time_series_df])x = i % 5if x == 0:sleep(65)i += 1#parsed_overview, parsed_intra, wiwtk#print(week_avgPEratio)allCompany_df

Above is the original python script I prototyped to make the API call so it’s a little messy, but you can refactor it to suit your needs. As always, I hope you enjoyed the post and thanks for reading.

--

--

Sean Byrne

I’m a data scientist