+----------------------------------------------------------------------+ | | | How do major technology stocks compare on trend, return, risk, | | correlation, and simple strategy behaviour? | | | +----------------------------------------------------------------------+
This project transforms five years of historical stock price data into a polished Streamlit analytics dashboard focused on one central question:
How do major technology stocks compare on trend, return, risk, correlation, and simple strategy behaviour?
The app combines exploratory analysis, return diagnostics, volatility measurement, correlation mapping, moving-average signal exploration, and lightweight backtesting into a portfolio-ready analytics experience built around Apple, Amazon, Google, and Microsoft.
| # | Section |
|---|---|
| 01 | Project Intention & Goals |
| 02 | Dataset at a Glance |
| 03 | Analysis Modules |
| 04 | Key Findings |
| 05 | Technical Pipeline |
| 06 | Technology Stack |
| 07 | Repository Structure |
| 08 | Run Locally |
| 09 | Dashboard Preview |
| 10 | About the Author |
| 11 | Suggested Resources |
This project was built to go beyond static price charts by treating historical stock data as a decision-support asset for comparative financial analysis.
- Compare four major technology stocks through a unified analytical framework
- Measure return, volatility, and risk-adjusted performance in one consistent view
- Reveal how strongly the stocks move together through price and return correlation
- Explore how moving averages change trend interpretation
- Visualise crossover signals in a dashboard-friendly way
- Compare a simple strategy against buy-and-hold for analytical context
- Present the work as a polished Streamlit application, not just a notebook
- Which stock delivered the strongest total return over the common analysis period?
- Which stock produced the best Sharpe Ratio?
- Which stock carried the highest day-to-day volatility?
- Which stocks move most similarly in return terms?
- How useful are moving-average crossover signals as a basic timing framework?
- Does a simple moving-average rule outperform passive buy-and-hold in this universe?
| Metric | Value |
|---|---|
| Stocks Covered | 4 |
| Companies | Apple, Amazon, Google, Microsoft |
| Raw Dataset Range | Feb 08, 2013 to Feb 07, 2018 |
| Common Comparison Window | Mar 2014 to Feb 2018 |
| Total Rows | 4,752 |
| Data Frequency | Daily |
| Strongest Return | Amazon (+318.6%) |
| Best Sharpe Ratio | Amazon (1.40) |
| Highest Volatility | Amazon (1.844) |
| Strongest Return Correlation Pair | Amazon / Google |
| File | Purpose |
|---|---|
individual_stocks_5yr/AAPL_data.csv |
Apple historical daily price data |
individual_stocks_5yr/AMZN_data.csv |
Amazon historical daily price data |
individual_stocks_5yr/GOOG_data.csv |
Google historical daily price data |
individual_stocks_5yr/MSFT_data.csv |
Microsoft historical daily price data |
Stock_price_analysis.ipynb |
Notebook-based exploratory and analytical workflow |
app.py + pages_content/ |
Streamlit dashboard interface and page routing |
The dashboard is organised as a compact analytical journey rather than a loose set of charts.
- Data Layer: loading, standardization, feature engineering, and KPI helpers
- Dataset Overview: structural inspection, coverage, schema, and quality context
- Trend Analysis: price history comparison with selectable moving averages
- Return Analysis: daily returns, distribution diagnostics, and cumulative performance
- Risk & Volatility: volatility, rolling risk, and Sharpe Ratio comparison
- Correlation Analysis: price and return heatmaps with pairwise relationship insight
- Signal Explorer: moving-average crossover detection and signal event review
- Strategy & Backtesting: simple MA-rule comparison versus buy-and-hold
- Key Insights: final interpretation, leadership, laggards, and realistic framing
Here is what the analysis says when the four-stock universe is compared on a consistent basis.
- Amazon led on absolute return at roughly +318.6%, making it the strongest performer in the group.
- Amazon also led on risk-adjusted return, posting the best annualised Sharpe Ratio at about 1.40.
- Higher reward came with higher risk, as Amazon also showed the highest volatility in the dataset.
- Google was the relative laggard in total-return terms within this four-stock universe.
- Amazon and Google formed the strongest return-correlation pair, indicating the closest day-to-day movement pattern.
- Technical signals add structure, not certainty. Moving averages help interpretation, but they are not treated as predictive truth.
Raw CSV Files
|
v
Data Loading and Validation
|
v
Feature Engineering
(daily returns, moving averages)
|
+----------------------+
| |
v v
Comparative Metrics Signal Generation
(return, risk, corr) (MA crossover logic)
| |
+----------+-----------+
|
v
Interactive Visualisation
(Plotly + Streamlit UI)
|
v
Portfolio-Style Dashboard
stock-price-analytics.streamlit.app
| Layer | Tools |
|---|---|
| Data Wrangling | pandas, numpy |
| Visualization | plotly |
| Dashboard | streamlit |
| Project Utilities | pathlib |
| Notebook Analysis | jupyter |
stock-price-analysis-time-series-python/
|
|-- app.py
|-- README.md
|-- requirements.txt
|-- Stock_price_analysis.ipynb
|
|-- assets/
| |-- profile.jpg
| |-- stock_price_trend_analysis.png
| |-- daily_return_analysis.png
| |-- volatility_comparison.png
| |-- risk_vs_return.png
| |-- corr_closing_price.png
| |-- corr_daily_return.png
| |-- moving_average_analysis.png
| |-- golden_cross_and_death_cross_analysis.png
| `-- app_sell_buy.png
|
|-- individual_stocks_5yr/
| |-- AAPL_data.csv
| |-- AMZN_data.csv
| |-- GOOG_data.csv
| `-- MSFT_data.csv
|
|-- pages_content/
| |-- about.py
| |-- correlation.py
| |-- dataset.py
| |-- home.py
| |-- insights.py
| |-- returns.py
| |-- risk.py
| |-- signals.py
| |-- strategy.py
| `-- trend.py
|
`-- utils/
|-- charts.py
|-- data.py
|-- sidebar.py
`-- styles.py
git clone https://github.com/doyancha/stock-price-analysis-time-series-python.git
cd stock-price-analysis-time-series-pythonpip install -r requirements.txtstreamlit run app.pyThe app will open locally at http://localhost:8501.
streamlit
pandas
numpy
plotlyThe repository already includes exported visuals in the assets folder, which makes it possible to preview the analytical scope even before launching the app.
![]() |
![]() |
![]() |
![]() |
| Page | Description |
|---|---|
| Home | Executive overview with KPIs and market-wide summary visuals |
| Dataset Overview | Structural inspection of rows, dates, coverage, and preprocessing |
| Trend Analysis | Price history and moving-average exploration |
| Return Analysis | Daily return behavior, distribution, and cumulative performance |
| Risk & Volatility | Volatility, Sharpe Ratio, and risk-return positioning |
| Correlation Analysis | Closing-price and return-level correlation mapping |
| Signal Explorer | Moving-average crossover events and stock-level signal tracking |
| Strategy & Backtesting | Simple MA strategy comparison versus buy-and-hold |
| Key Insights | Consolidated takeaways for interpretation and storytelling |
| About Project | Author profile, project context, and technology stack |
+---------------------------------------------------------+ | | | MIR SHAHADUT HOSSAIN | | Data Analyst | Streamlit Developer | | | | Turning historical data into structured insight. | | | +---------------------------------------------------------+
| Resource | Link |
|---|---|
| Streamlit Docs | docs.streamlit.io |
| Pandas Documentation | pandas.pydata.org/docs |
| NumPy Documentation | numpy.org/doc |
| Plotly Python Docs | plotly.com/python |
| Python pathlib Docs | docs.python.org/pathlib |
| Resource | Link |
|---|---|
| Kaggle Stock Price Dataset Concepts | kaggle.com |
| Investopedia Sharpe Ratio Guide | investopedia.com/sharpe-ratio |
| Investopedia Correlation Guide | investopedia.com/correlation |
| Streamlit Community Cloud | docs.streamlit.io/streamlit-community-cloud |




