πŸ“ˆ Real-Time Stock Movement Predictor using SVM + Streamlit

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MyrinNew
    Senior Member
    • Feb 2024
    • 5175

    #1

    πŸ“ˆ Real-Time Stock Movement Predictor using SVM + Streamlit

    πŸš€ Try the Live Demo

    πŸ‘‰ Live App

    🧠 GitHub Repo


    πŸ“Έ Project in Action

    UI:





    Model Evaluation:





    πŸ’‘ What Does This App Do?

    It predicts whether a stock’s next-day movement will be:


    πŸ“ˆ UP or πŸ“‰ DOWN


    You simply:


    Choose a stock (AAPL, MSFT, TSLA, etc.)

    Click β€œPredict”

    See the next-day prediction powered by an SVM model


    πŸ”§ How It Works

    βœ… Features Used:

    Past 3-day returns

    Short & Long moving averages

    Momentum = short βˆ’ long

    Volatility (rolling std dev)

    Ticker encoded as a feature


    πŸ“Š Model:

    SVM classifier trained on 3 years of daily data (from Yahoo Finance)

    Achieved ~99% test accuracy 🎯


    πŸ› οΈ Tech Stack

    Model Scikit-learn (SVM)
    Data Source yfinance (Yahoo Finance API)
    Frontend Streamlit
    Feature Engg pandas, NumPy
    Visualization seaborn, matplotlib


    πŸ“ Project Structure

    stock-movement-svm/

    β”œβ”€β”€ app.py # Streamlit frontend + logic

    β”œβ”€β”€ model.pkl # Trained SVM model

    β”œβ”€β”€ scaler.pkl # Feature scaler

    β”œβ”€β”€ generate_features.py # Feature generation logic

    β”œβ”€β”€ requirements.txt

    β”œβ”€β”€ screenshots/

    β”‚ β”œβ”€β”€ screenshot-ui.png

    β”‚ └── confusion-matrix.png

    └── README.md


    πŸ”Œ Run Locally

    git clone https://github.com/snoorbasha50/stock-movement-svm.git

    cd stock-movement-svm

    pip install -r requirements.txt

    streamlit run app.py


    πŸ” Future Enhancements

    Add more stocks dynamically

    Include candlestick chart visualizations

    Fine-tune SVM hyperparameters

    Try LSTM or deep learning for sequence modeling


    πŸ“¬ Let’s Connect

    πŸ’Ό LinkedIn

    🌐 GitHub




    More...
Working...