StoxChai NSE Stock Price Prediction Models

Overview

This repository contains machine learning models trained on NSE (National Stock Exchange of India) bhavcopy data for stock price prediction. The models are trained on data from January 1, 2025 to August 20, 2025, covering 3,257 unique stock symbols across 158 trading days.

Model Information

Data Source

  • Source: NSE Bhavcopy (daily market data)
  • Period: January 1, 2025 - August 20, 2025
  • Coverage: 3,257 Indian equity stocks
  • Features: 16 technical and price-based features

Features Used

  • Price Data: Open, High, Low, Close, Last Price, Previous Close
  • Technical Indicators: Price Range, Price Change, Price Change %, Volume-Price Ratio
  • Moving Averages: SMA_5, SMA_20
  • Momentum: Price Momentum, Volume MA, Volume Ratio
  • Volume: Total Trading Volume, Total Trading Value

Models Available

  1. RandomForest - Ensemble of 100 decision trees
  2. GradientBoosting - Gradient boosting with 100 estimators
  3. LinearRegression - Linear regression model
  4. Ridge - Ridge regression with L2 regularization
  5. Lasso - Lasso regression with L1 regularization
  6. SVR - Support Vector Regression
  7. XGBoost - Extreme Gradient Boosting
  8. LightGBM - Light Gradient Boosting Machine

Usage

Installation

pip install -r requirements.txt

Quick Start

from inference import StoxChaiStockPredictor
import numpy as np

# Initialize predictor
predictor = StoxChaiStockPredictor()

# Prepare your data (16 features in the same order as training)
features = [100.0, 105.0, 98.0, 102.0, 100.0, 7.0, 2.0, 2.0, 1.5, 
           101.0, 100.5, 0.01, 1000.0, 1.2, 1200.0, 120000.0]

# Single model prediction
prediction = predictor.predict(features, "randomforest")
print(f"Predicted stock price: ₹{prediction:.2f}")

# All models prediction
all_predictions = predictor.predict_all_models(features)
print(f"Ensemble prediction: ₹{all_predictions['ensemble']:.2f}")

Input Format

Your input should be a 1D array with exactly 16 features in this order:

  1. OpnPric (Open Price)
  2. HghPric (High Price)
  3. LwPric (Low Price)
  4. LastPric (Last Price)
  5. PrvsClsgPric (Previous Close Price)
  6. Price_Range
  7. Price_Change
  8. Price_Change_Pct
  9. Volume_Price_Ratio
  10. SMA_5
  11. SMA_20
  12. Price_Momentum
  13. Volume_MA
  14. Volume_Ratio
  15. TtlTradgVol (Total Trading Volume)
  16. TtlTrfVal (Total Trading Value)

Performance Metrics

  • Training Data: 464,548 samples
  • Validation: 20% holdout test set
  • Models trained successfully: 8/8
  • All models converged without errors

License

MIT License - See LICENSE file for details

Citation

If you use these models in your research, please cite:

@software{stoxchai_nse_predictor,
  title={StoxChai NSE Stock Price Prediction Models},
  author={StoxChai Team},
  year={2025},
  url={https://huggingface.co/thoutam/stoxchai-nse-predictor}
}

Support

For questions or issues, please open an issue on this repository.

Downloads last month
6
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support