↓ Skip to main content
  1. Resources/
  2. Articles & Projects/

Stock Market Analysis Using Python

295 words·2 mins· loading
Author
SaMoA Alamdari

Project: AI-Driven Stock Market Forecasting
#

The Challenge
#

Predicting stock trends is like reading tea leaves—volatile and unpredictable!

The Solution
#

I built a machine learning-powered dashboard that:

  • 📊 Visualizes real-time data with interactive candlestick charts

  • 🔮 Predicts trends using Linear Regression

  • 📈 Identifies optimal buy/sell points with RSI & Bollinger Bands

Key Insights
#

  1. Strong Correlation: Google & Amazon stocks move together (0.95 correlation).
  2. Amazon’s Volatility: 12% daily swings require careful timing.
  3. ML Predictions: $1 Google ↑ → $0.95 Amazon ↑.

Tech Stack
#

  • Python, yfinance, Plotly, Scikit-learn
  • Live updates via Yahoo Finance API

Explore the code and datasets on GitHub

The Data Alchemist: Transforming Raw Market Data into Actionable Insights
#

Act 1: Hunting Live Data
#

Live stock market data flows like a roaring river! Using the yfinance library:

  • Extracted 3 years of historical data for Google (GOOG), Apple (AAPL), and Amazon (AMZN).
  • First Insight: Amazon showed 12% higher volatility compared to others!

Act 2: Technical Enchantments
#

I crafted two powerful spells to decode stock secrets:

Relative Strength Index (RSI):
#

RSI > 70 → Overbought signal

RSI < 30 → Oversold signal

Bollinger Bands:
#

Price touches upper band → Likely price drop

Price touches lower band → Likely price rally

Act 3: The Interactive Crystal Ball
#

With Plotly, I built a magical dashboard:

Live candlestick charts with zoom/pan functionality.

Bollinger Bands in bold colors.

RSI displayed on a secondary axis.

Act 4: Unlocking Hidden Relationships
#

The correlation matrix revealed:

Google & Apple: 0.87 correlation

Google & Amazon: 0.95 correlation → Twin trends!

Amazon& Apple: 0.83 correlation

Act 5: Machine Learning Prophecy
#

With linear regression, I predicted:

$1 increase in Google → $0.95 rise in Amazon !

Multivariate model achieved 82% accuracy in forecasting Apple’s trends.