π‘ **Disclaimer**: This isn’t financial advice! DYOR and talk to a professional before making any investment decisions.

Finxter is all about staying on the right side of change. I have always believed in simple strategies like buying and holding good companies.

This backtesting study peeks into the past decade, mapping out a journey where a **consistent monthly investment of $600 in the tech industry’s leading giants** would have swelled to a staggering $500,000.

It’s a testament to the power of technological disruption and the magic of compounding, showcasing how patience, persistence, and a slice of Silicon Valley might be the ingredients to a robust financial future.

While past performance is no crystal ball into future gains, this research offers a fascinating glimpse into the ‘what ifs’ of tech stock investments and the huge benefit of playing the long game.

Let’s start with the top technology companies by market cap in 2014 (source):

We test a simple buy-and-hold strategy where you simply buy the top six tech stocks (by market cap) in the year 2014, assuming you don’t have any particular insight into the tech industry (e.g., seeing NVidia or Tesla early):

- Apple
- Microsoft
- IBM
- Oracle
- Meta

`tech_stocks = ['AAPL', 'GOOGL', 'MSFT', 'IBM', 'ORCL', 'META']`

In the US, the *average* income of a coder was roughly $76k per year in 2014 (source).

If you save only 10% of that, i.e., **$7,200** per year or **$600** monthly and you distribute that equally across the six chosen tech stocks, here’s the annual ownership of your stock portfolio:

π **Table**: The table displays the year-end values of equal monthly $100-investments in our six tech stocks from 2014 to 2024, alongside their Compound Annual Growth Rates (CAGR).

Each row corresponds to a different stock, with columns indicating the investment’s worth at the close of each year.

The CAGR column reflects the average annual growth rate of the investment over the ten-year period.

For instance, an investment in Apple (AAPL) grew from $1,734 in 2014 to $134,446 by 2024, with a CAGR of 27.38% and annual contributions of $1,200 into AAPL.

Your total portfolio value of this simple buy-and-hold portfolio would be north of $500,000 after 10 short years! In this scenario, a 50-year-old could retire today, having started with $0 in 2014!

Assuming the compound annual growth rate remains ~15%, you’re technically retired because you don’t need your $76k paycheck anymore, given your $75k+ return on investment from year 11 onward!

Today, the top six leading tech stocks by market cap are the following:

- Apple
- Microsoft
- Alphabet
- Amazon
- NVIDIA
- Meta

All of them will benefit greatly from the proliferation of AI in the next decade. Personally, I’d add the seventh largest tech company, Tesla, due to its disruptive opportunity of the Tesla bot:

π Tesla Bot Optimus: Is $5,000 per Share (TSLA) Realistic?

## Try It Yourself with This Python Script

You can recreate this using the following Python script.

First install these libraries:

pip install yfinance pandas numpy matplotlib

Then copy and paste the following code into your Python script (`my_file.py`

) and run it:

import yfinance as yf import pandas as pd import numpy as np import datetime import matplotlib.pyplot as plt import matplotlib.ticker as ticker # Define the time period for the data end_date = datetime.datetime.now() start_date = end_date - datetime.timedelta(days=10*365) # List of top tech stocks based on market capitalization from about 10 years ago tech_stocks = ['AAPL', 'GOOGL', 'MSFT'] # , 'IBM', 'ORCL', 'META'] # , 'TCEHY', 'QCOM', 'INTC', 'CSCO'] # Function to perform dollar-cost averaging investment strategy def dollar_cost_averaging(initial_investment, monthly_investment, data): investment_values = {} total_asset_values = pd.Series(dtype=float) for stock in tech_stocks: # Initial investment initial_stock_investment = initial_investment / len(tech_stocks) # Monthly investment dates investment_dates = pd.date_range(start=data[stock].index[0], end=data[stock].index[-1], freq='M') stock_investment = np.zeros(len(data[stock].index)) # Apply initial investment stock_investment[0] += initial_stock_investment for date in investment_dates: # Find the closest trading date closest_date = data[stock].index[data[stock].index.get_loc(date, method='nearest')] investment = monthly_investment / len(tech_stocks) stock_investment[data[stock].index.get_loc(closest_date)] += investment # Calculate cumulative investment cumulative_investment = np.cumsum(stock_investment) # Adjusted close price for the stock adj_close = data[stock]['Adj Close'] # Calculate asset value over time asset_value = cumulative_investment / adj_close.iloc[0] * adj_close investment_values[stock] = asset_value total_asset_values = total_asset_values.add(asset_value, fill_value=0) # Aggregate yearly values yearly_values = {} for stock, asset_value in investment_values.items(): # Resample the asset value data to get the value at the end of each year yearly_values[stock] = asset_value.resample('Y').last() return yearly_values, total_asset_values # Function to calculate CAGR def calculate_cagr(start_value, end_value, num_years): return (end_value / start_value) ** (1 / num_years) - 1 # Main function to execute the strategy def main(initial_investment, monthly_investment): # Download historical data for the stocks stock_data = yf.download(tech_stocks, start=start_date, end=end_date, group_by='ticker') yearly_values, total_asset_values = dollar_cost_averaging(initial_investment, monthly_investment, stock_data) # Creating a DataFrame for yearly values yearly_table = pd.DataFrame(yearly_values).T yearly_table.columns = yearly_table.columns.year # Use year as column names # Format the table for better readability formatted_table = yearly_table.round().astype(int).applymap("${:,}".format) # Calculate CAGR cagr_values = {} for stock in tech_stocks: start_value = stock_data[stock]['Adj Close'].iloc[0] end_value = stock_data[stock]['Adj Close'].iloc[-1] num_years = (stock_data[stock].index[-1] - stock_data[stock].index[0]).days / 365.25 cagr_values[stock] = calculate_cagr(start_value, end_value, num_years) cagr_df = pd.DataFrame(cagr_values, index=['CAGR']) cagr_df = cagr_df.T cagr_df['CAGR'] = cagr_df['CAGR'].apply(lambda x: f'{x:.2%}') # Combine yearly values and CAGR in a single DataFrame for display combined_df = pd.concat([formatted_table, cagr_df], axis=1) print("Yearly Investment Values and CAGR for Each Stock:") print(combined_df.to_string()) # Plotting the total asset value over time ax = total_asset_values.plot(title='Total Asset Value Over Time') ax.yaxis.set_major_formatter(ticker.FuncFormatter(lambda x, p: f'${x/1000:,.0f}K')) plt.xlabel('Date') plt.ylabel('Total Asset Value') plt.show() if __name__ == "__main__": initial_investment = 0 # Modify this value as needed monthly_investment = 600 # Modify this value as needed main(initial_investment, monthly_investment)

You can modify the initial and monthly investments in the variables at the bottom of this script. If you don’t know how to run a script, consider this Python guide: