Big Tech Stock Prices

Proposal

import numpy as np
import pandas as pd

Dataset

This dataset, “Big Tech Stock Prices,” sourced from Yahoo Finance via Kaggle (by Evan Gower), provides information on stock prices and associated details for prominent 14 technology companies including Apple (AAPL), Amazon (AMZN), Alphabet (GOOGL), Meta Platforms (META), and more.

There are 2 CSV files in the dataset:

big_tech_stock_prices.csv: This dataset captures daily stock market performance indicators of major technology firms from January 2010 onwards. It includes the following variables for each trading day:

stock_symbol: The stock ticker symbol for each company. date: The date of trading. open: The price at which the stock started trading when the market opened. high: The highest price of the stock during the trading day. low: The lowest price of the stock during the trading day. close: The price of the stock at market close. adj_close: The closing price of the stock after adjustments for all applicable splits and dividend distributions. volume: The number of shares that changed hands during the trading day.

stocks = pd.read_csv('data/big_tech_stock_prices.csv')
stocks.head()
stock_symbol date open high low close adj_close volume
0 AAPL 2010-01-04 7.622500 7.660714 7.585000 7.643214 6.515213 493729600
1 AAPL 2010-01-05 7.664286 7.699643 7.616071 7.656429 6.526476 601904800
2 AAPL 2010-01-06 7.656429 7.686786 7.526786 7.534643 6.422664 552160000
3 AAPL 2010-01-07 7.562500 7.571429 7.466071 7.520714 6.410790 477131200
4 AAPL 2010-01-08 7.510714 7.571429 7.466429 7.570714 6.453412 447610800

big_tech_companies.csv: This file serves as metadata, providing the names of companies alongside their associated stock symbols.

companies = pd.read_csv('data/big_tech_companies.csv')
companies.head()
stock_symbol company
0 AAPL Apple Inc.
1 ADBE Adobe Inc.
2 AMZN Amazon.com, Inc.
3 CRM Salesforce, Inc.
4 CSCO Cisco Systems, Inc.

Reason for Choosing This Dataset

We chose this dataset for its potential to provide valuable insights into the stock market behavior of big tech companies. The dataset encompasses a range of data types, including numerical values like stock prices and trading volumes and categorical data such as company names and dates. This composition enables a comprehensive examination of stock market trends, facilitates comparisons across various companies, and aids in assessing the influence of significant external events on stock valuations.

Questions

The two questions you want to answer.

Q1: How do stock prices change over time, looking at the basic information like open, close, high, low etc.

To address this question, we will analyze time-series data to understand the trajectory of stock prices. Key variables for this analysis include date, open, high, low, close, and volume. We will employ visualizations such as line graphs to depict trends and use measures such as the moving average to smooth out short-term fluctuations and highlight longer-term trends.

Q2: Backwards verification: if we invested x amount of dollars in 2010, how much would it be worth in 2022, when would be a good/bad time to pull investment out of the market.

By simulating an investment strategy where a fixed amount, say $10,000, is invested in a diversified portfolio of these tech stocks in 2010, we will compute its valuation in 2022. We will use the adj_close prices to account for stock splits and dividends. The analysis will also involve calculating the rate of return, identifying peaks and troughs in investment value over time, and determining strategic entry and exit points in the market.

Analysis plan

Q1

Analyzing stock prices from Big Tech Stock Price dataset over time using open, close, high, and low values. Creating visualizations like candlestick charts, line plots and bar plots to gain insights into the stock’s behavior. Bar plot depicts the volume of the stock which implies that taller the bar higher the stock trade. Each day has a total of 8 variables.

For Example: A Candlestick plot

import matplotlib.pyplot
import warnings
warnings.simplefilter("ignore", category=FutureWarning)
import plotly.graph_objects as go
df = stocks.copy()
df['date'] = pd.to_datetime(df['date'])

df_google = df[df['stock_symbol'] == 'GOOGL']
# Creating a candlestick chart
fig = go.Figure(data=[go.Candlestick(x=df_google['date'],
                open=df_google['open'],
                high=df_google['high'],
                low=df_google['low'],
                close=df_google['close'],
                name="Candlestick")])

# Customizing the layout
fig.update_layout(title='Candlestick Chart Example with GOOGLE stock',
                  xaxis_title='Date',
                  yaxis_title='Price',
                  xaxis_rangeslider_visible=False,
                  height=400)

# Showing the figure
fig.show()

And visualizing all stocks at once using line plots.

stocks = companies['stock_symbol'].values.tolist()
# Creating a DataFrame to hold all the stock data
# For simplicity, let's generate some random closing prices
all_stock_data = df

# Create a Plotly figure
fig = go.Figure()

# Add a line for each stock
for stock in stocks:
    stock_data = df[df['stock_symbol'] == stock]
    fig.add_trace(go.Scatter(x=stock_data['date'], y=stock_data['close'], mode='lines', name=stock))

# Customize the layout
fig.update_layout(
    title='Stock Close Prices Over Time',
    xaxis_title='Date',
    yaxis_title='Close Price',
    height=400
)

# Show the figure
fig.show()

Analysis

We plan to answer question one by investigating the rate of change of trading volume and average price over time to find trends that reveal good times to invest, i.e. when stock prices are about to grow exponentially, we would invest our money. Inversely, if we saw an exponential decrease in price over time, we would want to take our money out ASAP.

Q2

To determine the value of an investment in 2022 based on an initial investment in 2010, we need to know the annual rate of return of the investment over that time period. Without this information, it’s impossible to calculate the exact value of the investment in 2022.

However, we can make some generalizations:

  • 1.Using Historical Market Data

  • 2.Consulting Financial Professionals

Analysis

We will use DMA(daily moving averages) to create a generalized equation for how each stock grows over time, we can then see how money will grow in each stock by setting an initial investment and seeing its final value in 2022. To do so, we need to understand factors like inflation and interest rates, as well as annual rate of return.

Detailed Plan for Data Processing and Analysis

Step 1: Data Integration

Merge the big-tech-companies stock data with the supplementary list of companies to map stock_symbol to company names.

Ensure the date column is in the correct datetime format for time-series analysis.

Step 2: Data Cleaning

Check for missing values in both datasets and decide on an imputation strategy or whether to omit incomplete records.

Standardize text fields to ensure consistency (e.g., company names).

Step 3: Outlier Detection and Treatment

Use statistical methods such as Z-scores or IQR to identify outliers in stock prices.

Decide on a treatment strategy: removing, adjusting, or keeping outliers after contextual evaluation.

Step 4: Descriptive Analysis

Calculate summary statistics for stock prices and volumes to get an overall sense of the data distribution.

Visualize the distribution of data using histograms for each numerical variable.

Step 5: Trend Analysis (Q1)

Plot time-series graphs of stock prices to visualize trends over time.

Employ rolling averages to smooth out short-term fluctuations and highlight long-term patterns.

Step 6: Investment Analysis (Q2)

Simulate a $10,000 investment in a portfolio of the listed tech companies.

Calculate the value of the investment at the end of 2022 using adj_close prices.

Analyze the best and worst times to invest or divest by studying the rate of returns at different intervals.

Step 7: Reporting

Document the findings from the trend and investment analyses.

Highlight key insights regarding market behavior, investment opportunities, and risks.

Step 8: Final Review and Wrap-up

Review the entire analysis for coherence and accuracy.

Prepare a final report and presentation summarizing methodologies, findings, and insights.