Premchan369 commited on
Commit
5d5ab7d
·
verified ·
1 Parent(s): 3fffb66

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +149 -0
README.md ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AlphaForge - Multi-Asset Quantitative Trading System
2
+
3
+ A comprehensive quantitative trading system that combines price-based alpha signals, financial sentiment analysis, volatility forecasting, portfolio optimization, and ML-based options pricing.
4
+
5
+ ## Features
6
+
7
+ ### 1. Multi-Asset Alpha Model
8
+ - **LSTM** neural network for sequential pattern recognition
9
+ - **Transformer** architecture for attention-based forecasting
10
+ - **XGBoost** ensemble for robust feature-based predictions
11
+ - **Ensemble** combining all three with IC-weighted blending
12
+ - **IC Tracking**: Information Coefficient monitoring over time
13
+ - **Feature Drift Detection**: XGBoost importance divergence tracking
14
+
15
+ ### 2. News + Sentiment Alpha (FinBERT)
16
+ - Uses `ProsusAI/finbert` for financial sentiment analysis
17
+ - Converts news/social media into numerical alpha signals
18
+ - Confidence-weighted aggregation per asset per day
19
+ - Synthetic news generation for testing
20
+
21
+ ### 3. Volatility Forecasting Engine
22
+ - **GARCH(1,1)** with Student-t errors for baseline
23
+ - **LSTM** with skewed Student's t distributional output
24
+ - **EWMA covariance** matrix construction
25
+ - Positive definite enforcement
26
+
27
+ ### 4. Portfolio Optimizer
28
+ - Mean-variance optimization with transaction costs
29
+ - Max Sharpe ratio optimization
30
+ - Minimum volatility with return constraints
31
+ - **Robust optimization** with uncertainty sets
32
+ - **Black-Litterman** model for incorporating views
33
+ - Efficient frontier computation
34
+
35
+ ### 5. Options Pricing with ML
36
+ - 4-layer neural network (256-128-64-32)
37
+ - Black-Scholes baseline for comparison
38
+ - Implied volatility prediction
39
+ - **Mispricing detection** for arbitrage signals
40
+ - Synthetic data generation for training
41
+
42
+ ### 6. Backtest Engine
43
+ - Transaction cost and slippage simulation
44
+ - Comprehensive metrics:
45
+ - Sharpe, Sortino, Calmar ratios
46
+ - Max drawdown, win rate
47
+ - Alpha, Beta, Information Ratio
48
+ - Turnover and cost analysis
49
+ - Regime detection (bull/bear/high-vol)
50
+ - Rolling performance metrics
51
+
52
+ ## Installation
53
+
54
+ ```bash
55
+ git clone https://huggingface.co/Premchan369/alphaforge-quant-system
56
+ cd alphaforge-quant-system
57
+ pip install -r requirements.txt
58
+ ```
59
+
60
+ ## Usage
61
+
62
+ ### Train Alpha Model
63
+ ```bash
64
+ python main.py --mode train --tickers SPY QQQ AAPL MSFT --epochs 50
65
+ ```
66
+
67
+ ### Run Full Backtest
68
+ ```bash
69
+ python main.py --mode backtest --start 2020-01-01 --end 2024-01-01
70
+ ```
71
+
72
+ ### Train Options Model
73
+ ```bash
74
+ python main.py --mode options
75
+ ```
76
+
77
+ ## Pipeline Architecture
78
+
79
+ ```
80
+ Market Data (OHLCV)
81
+ |
82
+ +---> Technical Indicators (RSI, MACD, Bollinger, etc.)
83
+ +---> Cross-Asset Features (beta, correlation, spreads)
84
+ |
85
+ v
86
+ Alpha Model (LSTM + Transformer + XGBoost Ensemble)
87
+ |---> Predicted Returns (mu)
88
+ |---> IC Tracking
89
+ |
90
+ News Data
91
+ |
92
+ v
93
+ Sentiment Model (FinBERT)
94
+ |---> Sentiment Alpha (S_t)
95
+ |
96
+ v
97
+ Combined Alpha = w1 * Price Alpha + w2 * Sentiment Alpha
98
+
99
+ Market Data
100
+ |
101
+ v
102
+ Volatility Engine (GARCH + LSTM)
103
+ |---> Covariance Matrix (Sigma)
104
+ |
105
+ v
106
+ Portfolio Optimizer (Mean-Variance / Max Sharpe / Robust)
107
+ |---> Optimal Weights (w)
108
+ |
109
+ v
110
+ Backtest Engine
111
+ |---> PnL, Sharpe, Drawdown, etc.
112
+ ```
113
+
114
+ ## Key Metrics
115
+
116
+ | Metric | Description |
117
+ |--------|-------------|
118
+ | **IC** | Information Coefficient (rank correlation between predicted and actual returns) |
119
+ | **Sharpe** | Risk-adjusted return (excess return / volatility) |
120
+ | **Sortino** | Downside risk-adjusted return |
121
+ | **Max DD** | Maximum peak-to-trough decline |
122
+ | **Calmar** | Annualized return / max drawdown |
123
+ | **Alpha** | Excess return vs benchmark |
124
+ | **Beta** | Market sensitivity |
125
+
126
+ ## File Structure
127
+
128
+ | File | Description |
129
+ |------|-------------|
130
+ | `main.py` | Entry point and orchestration |
131
+ | `market_data.py` | Data fetching and feature engineering |
132
+ | `alpha_model.py` | LSTM/Transformer/XGBoost ensemble |
133
+ | `sentiment_model.py` | FinBERT sentiment analysis |
134
+ | `volatility_model.py` | GARCH + LSTM volatility forecasting |
135
+ | `portfolio_optimizer.py` | Mean-variance and robust optimization |
136
+ | `options_pricer.py` | ML options pricing and mispricing detection |
137
+ | `backtest_engine.py` | Backtesting with comprehensive metrics |
138
+
139
+ ## Research Backing
140
+
141
+ - **Alpha Models**: xLSTM-TS with wavelet denoising (Lopez Gil et al., 2024)
142
+ - **Sentiment**: FinBERT (Araci, 2019) with ChatGPT benchmarking (Fatouros et al., 2023)
143
+ - **Volatility**: LSTM with skewed Student's t (Michankow, 2025)
144
+ - **Portfolio**: Multi-task learning for joint optimization (Ong & Herremans, 2023)
145
+ - **Options**: 5-layer FNN outperforming Black-Scholes (Berger et al., 2023)
146
+
147
+ ## License
148
+
149
+ MIT