Skip to the content.

← Back to Home

Stock Price Analysis and Prediction

View Code on GitHub


Overview

This project presents a comprehensive approach to Stock Price Analysis and Prediction, encompassing:

  1. Data Retrieval:
    • Fetching historical stock data using the Financial Modeling Prep (FMP) API.
  2. Technical Indicator Computation:
    • Calculating various technical indicators to analyze stock trends and volatility.
  3. Machine Learning Models:
    • Implementing models such as Linear Regression, Random Forest, and Long Short-Term Memory (LSTM) networks for stock price prediction.

Features

Data Retrieval:

Technical Indicator Computation:

Machine Learning Models:


How It Works

  1. Data Retrieval:
    • The stock_history function fetches historical stock data for a specified ticker, year, and month using the FMP API.
  2. Technical Indicator Computation:
    • Functions like calculate_moving_averages, calculate_rsi, and calculate_macd compute respective technical indicators using the ta library.
  3. Machine Learning Modeling:
    • The prepare_data function structures the data with lag features for regression models.
    • The train_predict_lr_rf function trains and evaluates Linear Regression and Random Forest models.
    • The prepare_lstm_data and train_predict_lstm functions handle data preparation and training for LSTM networks.
  4. Prediction and Evaluation:
    • Models are evaluated using metrics such as Root Mean Squared Error (RMSE) to assess prediction accuracy.

Technologies


← Back to Home