|
|
--- |
|
|
language: |
|
|
- en |
|
|
tags: |
|
|
- finance |
|
|
- stock-market |
|
|
- lstm |
|
|
- time-series |
|
|
- prediction |
|
|
- nse |
|
|
- india |
|
|
- technical-analysis |
|
|
license: mit |
|
|
datasets: |
|
|
- nse-bhavcopy |
|
|
metrics: |
|
|
- mae |
|
|
- mse |
|
|
library_name: tensorflow |
|
|
pipeline_tag: time-series-forecasting |
|
|
--- |
|
|
|
|
|
# NSE LSTM Model - Indian Stock Market Prediction |
|
|
|
|
|
## Overview |
|
|
This is a comprehensive LSTM (Long Short-Term Memory) neural network model trained on **6.8 million records** across **3,622 symbols** from the National Stock Exchange (NSE) of India. The model covers data from 2004-2025 and provides stock price predictions based on technical indicators and historical patterns. |
|
|
|
|
|
## Model Details |
|
|
- **Architecture**: LSTM with Dropout layers |
|
|
- **Input Shape**: (batch_size, 5, 25) - 5 days × 25 features |
|
|
- **Output**: Single prediction value for next day's price |
|
|
- **Training Data**: 6,795,445 records across 3,622 symbols |
|
|
- **Features**: OHLCV data + 20 technical indicators |
|
|
- **Model Size**: 0.23 MB |
|
|
- **Parameters**: 16,289 |
|
|
|
|
|
## Features |
|
|
- **Price Data**: OPEN, HIGH, LOW, CLOSE, VOLUME |
|
|
- **Technical Indicators**: |
|
|
- Moving Averages (5, 10, 20, 50 day) |
|
|
- Bollinger Bands (20 day) |
|
|
- RSI (14 day) |
|
|
- MACD |
|
|
- Volume indicators (OBV, VPT) |
|
|
|
|
|
## Usage |
|
|
|
|
|
### Python |
|
|
```python |
|
|
import tensorflow as tf |
|
|
import pickle |
|
|
import numpy as np |
|
|
|
|
|
# Load model and scaler |
|
|
model = tf.keras.models.load_model("nse_lstm_model.keras") |
|
|
with open("nse_lstm_scaler.pkl", "rb") as f: |
|
|
scaler = pickle.load(f) |
|
|
|
|
|
# Prepare input data (5 days × 25 features) |
|
|
input_data = np.random.randn(1, 5, 25) # Your normalized features here |
|
|
|
|
|
# Make prediction |
|
|
prediction = model.predict(input_data) |
|
|
print(f"Predicted price change: {prediction[0][0]}") |
|
|
``` |
|
|
|
|
|
### Input Data Format |
|
|
Your input should be normalized data with shape (batch_size, 5, 25): |
|
|
- **5**: Number of days (lookback period) |
|
|
- **25**: Number of features (OHLCV + technical indicators) |
|
|
|
|
|
### Output |
|
|
The model outputs a single value representing the predicted price change/movement for the next day. |
|
|
|
|
|
## Data Sources |
|
|
- **NSE Bhavcopy**: Daily equity data from 2004-2025 |
|
|
- **Symbols**: 3,622 unique equity symbols |
|
|
- **Frequency**: Daily data points |
|
|
- **Coverage**: All major Indian stocks |
|
|
|
|
|
## Performance |
|
|
- **Training MAE**: 0.0216 |
|
|
- **Validation MAE**: 0.0217 |
|
|
- **Memory Efficient**: Processes large datasets with minimal memory usage |
|
|
- **Fast Inference**: Optimized for real-time predictions |
|
|
|
|
|
## License |
|
|
MIT License - Free for commercial and research use. |
|
|
|
|
|
## Citation |
|
|
If you use this model in your research, please cite: |
|
|
``` |
|
|
@software{nse_lstm_model, |
|
|
title={NSE LSTM Model - Indian Stock Market Prediction}, |
|
|
author={Your Name}, |
|
|
year={2025}, |
|
|
url={https://huggingface.co/thoutam/nse-lstm-model} |
|
|
} |
|
|
``` |
|
|
|
|
|
## Support |
|
|
For questions or issues, please open an issue on the Hugging Face repository. |
|
|
|