I've always entertained the idea of actively investing in stocks (especially when I hear news of significant growth in the investments of big players after major world events). I find it overwhelming though, especially with so many companies to choose from and factors to consider before selecting stocks to invest in.
I recently started doing some Data Analytics, Machine Learning and AI courses as part of the M2M DataTalent program. For my first capstone project, I analysed ten years (2012 - 2022) of daily stock data for major social media companies (Facebook (Meta), Twitter, Snapchat, Etsy, and Pinterest) to uncover valuable insights.
Data Source: Kaggle
Key Findings from the Analysis
1. Price Trends Over Time
I tracked the adjusted closing prices of these stocks over the period using a comparative line chart. This visualized how the value of each stock evolved and highlighted significant moments of growth or decline.
Relevance: This shows which stocks have shown consistent growth and which have faced major challenges, useful information for investors to understand long-term stability.
2. Trading Volume Analysis
I compared the trading volumes across stocks using stacked bar charts. Volume measures how actively a stock is being bought and sold — a key indicator of market interest.
Relevance: High trading volumes may indicate investor confidence (or sometimes lack thereof) or reactions to major news, while low volumes could signal lack of interest or stability.
3. Correlation Between Stocks
A correlation heatmap revealed how closely the stocks move in relation to each other which was to be expected given that they are all in the same market.
Out of curiosity, I decided to also compare these stocks to a completely different investment (in this case, Gold) to observe their correlation. As expected, the correlation between gold and the other stocks though negative, was barely existent.
Gold Data Source: Kaggle
Relevance: Understanding these relationships would help investors diversify portfolios to manage risk better.
4. Daily Returns and Volatility
I analyzed the daily returns, which is simply how much a stock’s price changes day to day, and mapped their distributions.
This helped to assess:
Average returns (potential gains).
Variability (volatility or risk).
Extreme values (outliers that may indicate unusual events).
Relevance: This gives a clear picture of what to expect from a stock — steady growth or erratic swings between growth and decline.
5. Cumulative Returns
Analysis of the stock cumulative returns is relevant to show the total growth of the stock investments over time. This provides a long-term perspective.
Relevance: From the chart above, one can easily infer which stocks would have provided the best returns for investors who held their stocks for years.
Conclusion
The stock market is very complex, especially for novice investors like me. I now understand however (and I hope you do too), that with the right tools and insights, it becomes easier to navigate. By analyzing historical data and focusing on important metrics like price trends, volumes, and returns, one can start building a solid foundation in stock investment.
Addendum: The Tools Behind the Analysis
To perform this analysis, I used a range of data science tools and techniques. Here are the tools used:
Python: The programming language used for data cleaning, processing, and visualization.
NumPy: For handling numerical data and performing mathematical calculations.
Pandas: A Python library that makes it easy to manipulate and analyze large datasets.
Bokeh: Visualization tool used to create charts.
Jupyter Notebooks: An interactive coding environment where the analysis was conducted and documented. The code used in this analysis can be viewed in this notebook.
Top comments (0)