Easy to follow stock price analysis forecasting techniques on Indian stock data
Click to expand
This project uses historical data acquired from publicly available sources listed below:
Development of this project was done inside a developmental Docker container using the base image of Python v3.11.6
. The same environment can be set up using the docker-compose.yml
available here.
All top level packages used in this project are listed in the requirements file. This project does not use any niche functionality from any of the listed packages and hence should work with their most recent releases.
The code in this project consists primarily of notebooks with some utility code available as scripts. Currently, there are 5 notebooks as described below:
- Consolidates historical and PE data from multiple years for each available stock ticker symbol into a parquet file
- Must be run once before any of the following notebooks
- Performs data processing on the consolidated data and generates new features for analysis and forecasting such as:
- Candle ranges
- Whether the candle is green or red
- Running streak
- Moving averages over multiple periods for fields such as stock prices, volumes and number of trades
- Generates two parquet files for each ticker symbol:
processed
- Original data with new features. Primarily used for analysis.standardized
- Features standardized to denote percentage changes within the same row. Primarily used for forecasting.
- Must be run for each available
STOCK_SYMBOL
once before any of the following notebooks
- Exploratory data analysis using various visualisations
- Analysis is divided into 3 sections:
- Historical - Descriptive, cumulative and grouped statistics over the entire historical data such as:
Close
price CDF- Proportion of candle types by year and quarter
- Normalized candle size by type, year and quarter
- Streaks of green and red candles and their overall distribution
- Current - Analysis of the most recent stock prices such as:
- The time when the latest price was first reached
- Momentum using ADAM for past few trading days
- Trends - Overall trend of various features over the entire period
- Historical - Descriptive, cumulative and grouped statistics over the entire historical data such as:
- Stock price forecasting for multiple time periods using
RandomForestRegressor
- Data for each day is assumed to be independent and an individual data point
- All models are hyperparameter tuned for best performance
- Stock price forecasting for multiple time periods using
GradientBoostingRegressor
- Lower and upper bounds are also calculated using Quantile regression
- Data for each day is assumed to be independent and an individual data point
- All models are hyperparameter tuned for best performance
- This project only focuses on day level stock price data and does not factor in intraday price changes.
- Currently, the analysis doesn't factor in stock splits, bonus shares, etc. as structured data for the same is difficult to obtain.
- This project is only meant to be educational and should not be interpreted as a financial advice.
@misc{MayurGarg_FinancialModelling,
title={Financial Modelling},
author={Mayur Garg},
year={2024},
url={https://github.com/mayur7garg/FinancialModelling}
}
Developed by - Mayur Garg