A comprehensive collection of quantitative finance research spanning classical trading strategies, deep learning models for price prediction, ensemble ML methods, and modern LLM-powered financial analysis.
- Overview
- Repository Structure
- Trading Strategies
- Machine Learning for Trading
- Deep Learning Models
- LLM-Powered Analysis (RAG)
- Risk Management
- Tech Stack
- Getting Started
- License
This repository serves as a quantitative finance research lab β a curated collection of Jupyter notebooks and Python scripts covering the full spectrum of algorithmic trading and financial machine learning. From classical technical analysis strategies backtested with industry-standard frameworks, to cutting-edge deep learning price predictors and LLM-augmented financial agents.
- 15+ trading strategies implemented and backtested across multiple frameworks
- Reinforcement Learning agent (Q-learning) for autonomous buy/sell/hold decisions
- Deep Learning pipelines β LSTM, RNN, and DNN models for price prediction
- Ensemble ML methods β Random Forest, Gradient Boosting, AdaBoost with SHAP explainability
- RAG-powered financial analysis using LangChain/LangGraph with OpenAI & Google Gemini
- Risk analytics including Value at Risk (VaR) and Conditional VaR (CVaR)
π¦ QUANT
βββ π€ Predicting_Stock_Prices_using_Reinforcement_Learning.ipynb
β
βββ π§ ML/RAG/ # Modern AI-powered analysis
β βββ yfinance.ipynb # Fundamental analysis with yfinance
β βββ bollinger z-score/
β βββ Bollinger_bands.ipynb # Bollinger Bands strategy
β βββ RAG_Langgrap_z-score.ipynb # LangGraph RAG agent for Z-score analysis
β βββ requirements.txt
β
βββ π quantopian/ # Classical algorithmic trading
β βββ Backtesting *.ipynb # Zipline & Pandas backtesting suite
β βββ backtrader_*_strategy.py # Backtrader strategy implementations
β βββ Backtrader_*.ipynb # ConnorsRSI, Donchian, Dual MA
β βββ Dual Moving Average *.ipynb # SMA crossover strategies
β βββ Zipline *.ipynb # Zipline examples with Pyfolio
β βββ VaR and CVaR.ipynb # Risk measurement
β βββ Linear Regression.ipynb # Statistical modeling
β βββ Pipeline algorithm.ipynb # Factor pipeline
β
βββ π² QUANTRA/ # ML & DL coursework
βββ Decision Trees/ # Ensemble methods & tree models
β βββ Classification Tree *.ipynb # Classification with SHAP
β βββ Regression Tree.ipynb # Price regression
β βββ Random Forest.ipynb # Ensemble learning
β βββ Gradient Boosting.ipynb # Sequential ensembles
β βββ AdaBoosting.ipynb # Adaptive boosting
β βββ Bagging.ipynb # Bootstrap aggregating
β βββ Cross Validation.ipynb # Model validation
β βββ Hyperparameter Tuning.ipynb # Grid/random search
β
βββ Neural Networks for trading/ # Deep learning models
β βββ LSTM Based Strategy.ipynb # LSTM trading strategy
β βββ LSTM- Price Prediction.ipynb # LSTM price forecasting
β βββ Deep Neural Network *.ipynb # DNN prediction model
β βββ RNN- Example.ipynb # Recurrent networks
β βββ Neural Network.ipynb # sklearn MLPClassifier
β βββ Cross Validation in Keras.ipynb
β βββ Keras_CV.py # DNN builder utility
β
βββ Sentimental Analisys/ # Market sentiment
βββ TRIN strategy.ipynb # Arms Index strategy
βββ plot_anomaly_comparison.ipynb # Anomaly detection
| Strategy | Framework | Description |
|---|---|---|
| Dual Moving Average Crossover | Zipline, Backtrader | Classic SMA crossover signals applied to AAPL and other equities |
| ConnorsRSI | Backtrader | Composite momentum indicator combining RSI, streak length, and percent rank |
| Donchian Channels | Backtrader | Breakout strategy using configurable lookback channel highs/lows |
| Bollinger Bands / Z-Score | Custom + RAG | Mean-reversion strategy with statistical Z-score thresholds |
| TRIN (Arms Index) | Custom | Market breadth indicator using NYSE advancing/declining volume |
| Pipeline Factor Model | Quantopian-style | Multi-factor alpha pipeline with Alphalens analysis |
Full pipeline from basic classification trees to advanced ensemble methods with model interpretability.
- Classification Trees β Binary decision models with class weight tuning and SHAP explainability
- Regression Trees β Non-linear price regression for continuous target prediction
- Bagging β Bootstrap aggregation for variance reduction
- Random Subspace β Feature-space sampling for diversity
- Random Forest β Combined bagging + random subspace ensemble
- AdaBoost β Adaptive sequential boosting with sample reweighting
- Gradient Boosting β Iterative residual minimization ensemble
- Cross Validation β K-fold validation for robust model evaluation
- Hyperparameter Tuning β Grid and random search optimization
| Model | Purpose | Key Details |
|---|---|---|
| LSTM | Price prediction & trading strategy | Sequence modeling on AMZN historical data |
| RNN | Close price prediction | Recurrent architecture for time-series |
| DNN | Trading strategy signals | Deep feedforward network (Keras Sequential) |
| MLPClassifier | Signal classification | scikit-learn neural network for trade signals |
| RL Q-Learning Agent | Autonomous trading | Epsilon-greedy policy with DNN Q-function approximation |
The root-level notebook implements a Q-learning agent that learns optimal trading actions (Buy / Sell / Hold) through interaction with historical market data. The agent uses a deep neural network to approximate the Q-value function with epsilon-greedy exploration.
State β [DNN Q-Network] β Q(s, buy), Q(s, sell), Q(s, hold) β Action
β
Experience Replay + Target Updates
Retrieval-Augmented Generation pipelines for intelligent financial research.
- LangGraph Agent β Multi-tool agentic workflow with tool-calling capabilities for fundamental and technical analysis
- Bollinger Z-Score RAG β LLM-augmented statistical analysis combining Bollinger Bands with AI-driven interpretation
- yfinance Fundamental RAG β Balance sheet, income statement, and cash flow analysis powered by LLMs
- Supported LLM backends β OpenAI GPT, Google Gemini, Vertex AI
LangChain β LangGraph β [OpenAI / Google Gemini] β Tool Calls β yfinance / fmpsdk
β
Financial Reports + Analysis
- Value at Risk (VaR) β Monte Carlo simulation for portfolio loss estimation at confidence levels
- Conditional VaR (CVaR) β Expected Shortfall: average loss exceeding the VaR threshold
- Statistical Foundations β Discrete & continuous random variable analysis for financial modeling
| Category | Technologies |
|---|---|
| Languages | Python 3.8+ |
| Backtesting | Backtrader, Zipline, Pyfolio, Alphalens |
| Deep Learning | TensorFlow, Keras (LSTM, RNN, Dense) |
| Machine Learning | scikit-learn, SHAP, XGBoost |
| LLM / RAG | LangChain, LangGraph, OpenAI API, Google Gemini, Vertex AI |
| Data & Finance | Pandas, NumPy, SciPy, yfinance, Quandl, fmpsdk |
| Visualization | Matplotlib, Plotly |
| Environment | Jupyter, Google Colab, Streamlit |
python >= 3.8
pip install jupyter numpy pandas matplotlibpip install backtrader zipline-reloaded pyfolio-reloaded alphalens-reloaded
pip install yfinance quandlpip install scikit-learn tensorflow keras shappip install langchain langchain-openai langchain-google-genai langgraph
pip install tavily-python python-dotenv streamlitjupyter notebook
# or
jupyter labNote: Some notebooks require API keys (OpenAI, Google, Tavily, Financial Modeling Prep). Create a
.envfile with the required credentials for the RAG pipelines.
This project is provided for educational and research purposes. Feel free to use, modify, and learn from the code.
Built with curiosity at the intersection of Finance, Machine Learning, and Artificial Intelligence.
Reinforcement Learning Β· LSTM Β· Random Forests Β· Bollinger Bands Β· ConnorsRSI Β· Donchian Channels Β· VaR/CVaR Β· LangGraph RAG Β· Backtrader Β· Zipline