alphaforged 0.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- alphaforged-0.3.2/PKG-INFO +496 -0
- alphaforged-0.3.2/README.md +449 -0
- alphaforged-0.3.2/pyproject.toml +80 -0
- alphaforged-0.3.2/setup.cfg +4 -0
- alphaforged-0.3.2/src/alphaforge/__init__.py +5 -0
- alphaforged-0.3.2/src/alphaforge/alerting/__init__.py +1 -0
- alphaforged-0.3.2/src/alphaforge/alerting/channels.py +245 -0
- alphaforged-0.3.2/src/alphaforge/alerting/dispatcher.py +152 -0
- alphaforged-0.3.2/src/alphaforge/alerts/__init__.py +1 -0
- alphaforged-0.3.2/src/alphaforge/alerts/engine.py +185 -0
- alphaforged-0.3.2/src/alphaforge/alerts/notifier.py +69 -0
- alphaforged-0.3.2/src/alphaforge/analysis/__init__.py +1 -0
- alphaforged-0.3.2/src/alphaforge/analysis/consensus.py +195 -0
- alphaforged-0.3.2/src/alphaforge/analysis/scanner.py +178 -0
- alphaforged-0.3.2/src/alphaforge/analysis/stock_analyzer.py +440 -0
- alphaforged-0.3.2/src/alphaforge/api/__init__.py +3 -0
- alphaforged-0.3.2/src/alphaforge/api/contracts.py +51 -0
- alphaforged-0.3.2/src/alphaforge/backtesting/__init__.py +13 -0
- alphaforged-0.3.2/src/alphaforge/backtesting/engine.py +102 -0
- alphaforged-0.3.2/src/alphaforge/backtesting/metrics.py +225 -0
- alphaforged-0.3.2/src/alphaforge/backtesting/monte_carlo.py +132 -0
- alphaforged-0.3.2/src/alphaforge/backtesting/slippage.py +144 -0
- alphaforged-0.3.2/src/alphaforge/backtesting/walk_forward.py +238 -0
- alphaforged-0.3.2/src/alphaforge/cli.py +61 -0
- alphaforged-0.3.2/src/alphaforge/config.py +83 -0
- alphaforged-0.3.2/src/alphaforge/dashboard/__init__.py +1 -0
- alphaforged-0.3.2/src/alphaforge/dashboard/app.py +354 -0
- alphaforged-0.3.2/src/alphaforge/data/__init__.py +3 -0
- alphaforged-0.3.2/src/alphaforge/data/batch_fetcher.py +144 -0
- alphaforged-0.3.2/src/alphaforge/data/cache_store.py +217 -0
- alphaforged-0.3.2/src/alphaforge/data/event_bus.py +36 -0
- alphaforged-0.3.2/src/alphaforge/data/free_market_data.py +1380 -0
- alphaforged-0.3.2/src/alphaforge/data/universe_filter.py +130 -0
- alphaforged-0.3.2/src/alphaforge/domain/__init__.py +33 -0
- alphaforged-0.3.2/src/alphaforge/domain/models.py +168 -0
- alphaforged-0.3.2/src/alphaforge/execution/__init__.py +4 -0
- alphaforged-0.3.2/src/alphaforge/execution/alerts.py +66 -0
- alphaforged-0.3.2/src/alphaforge/execution/order_simulator.py +544 -0
- alphaforged-0.3.2/src/alphaforge/execution/risk_engine.py +91 -0
- alphaforged-0.3.2/src/alphaforge/explainability/__init__.py +1 -0
- alphaforged-0.3.2/src/alphaforge/explainability/shap_explainer.py +295 -0
- alphaforged-0.3.2/src/alphaforge/explanation/__init__.py +5 -0
- alphaforged-0.3.2/src/alphaforge/explanation/engine.py +549 -0
- alphaforged-0.3.2/src/alphaforge/explanation/llm_synthesizer.py +423 -0
- alphaforged-0.3.2/src/alphaforge/explanation/models.py +70 -0
- alphaforged-0.3.2/src/alphaforge/features/__init__.py +3 -0
- alphaforged-0.3.2/src/alphaforge/features/expanded.py +609 -0
- alphaforged-0.3.2/src/alphaforge/features/store.py +39 -0
- alphaforged-0.3.2/src/alphaforge/features/technical.py +302 -0
- alphaforged-0.3.2/src/alphaforge/fundamentals/__init__.py +5 -0
- alphaforged-0.3.2/src/alphaforge/fundamentals/dimensions.py +435 -0
- alphaforged-0.3.2/src/alphaforge/fundamentals/engine.py +337 -0
- alphaforged-0.3.2/src/alphaforge/fundamentals/models.py +60 -0
- alphaforged-0.3.2/src/alphaforge/models/__init__.py +10 -0
- alphaforged-0.3.2/src/alphaforge/models/algorithms/__init__.py +83 -0
- alphaforged-0.3.2/src/alphaforge/models/algorithms/adversarial.py +333 -0
- alphaforged-0.3.2/src/alphaforge/models/algorithms/base.py +34 -0
- alphaforged-0.3.2/src/alphaforge/models/algorithms/lstm_advanced.py +910 -0
- alphaforged-0.3.2/src/alphaforge/models/algorithms/mamba_predictor.py +325 -0
- alphaforged-0.3.2/src/alphaforge/models/algorithms/ml_models.py +379 -0
- alphaforged-0.3.2/src/alphaforge/models/algorithms/momentum.py +326 -0
- alphaforged-0.3.2/src/alphaforge/models/algorithms/pattern.py +198 -0
- alphaforged-0.3.2/src/alphaforge/models/algorithms/regime_model.py +245 -0
- alphaforged-0.3.2/src/alphaforge/models/algorithms/timesfm_predictor.py +215 -0
- alphaforged-0.3.2/src/alphaforge/models/algorithms/transparency.py +1731 -0
- alphaforged-0.3.2/src/alphaforge/models/algorithms/trend.py +187 -0
- alphaforged-0.3.2/src/alphaforge/models/algorithms/volatility.py +281 -0
- alphaforged-0.3.2/src/alphaforge/models/algorithms/volume.py +283 -0
- alphaforged-0.3.2/src/alphaforge/models/base.py +62 -0
- alphaforged-0.3.2/src/alphaforge/models/ensemble.py +78 -0
- alphaforged-0.3.2/src/alphaforge/models/regime.py +51 -0
- alphaforged-0.3.2/src/alphaforge/operator_console/__init__.py +1 -0
- alphaforged-0.3.2/src/alphaforge/operator_console/_util.py +12 -0
- alphaforged-0.3.2/src/alphaforge/operator_console/app.py +1765 -0
- alphaforged-0.3.2/src/alphaforge/operator_console/router_alerts.py +121 -0
- alphaforged-0.3.2/src/alphaforge/operator_console/router_portfolio.py +210 -0
- alphaforged-0.3.2/src/alphaforge/operator_console/router_screener.py +150 -0
- alphaforged-0.3.2/src/alphaforge/operator_console/router_stock_detail.py +143 -0
- alphaforged-0.3.2/src/alphaforge/operator_console/server.py +16 -0
- alphaforged-0.3.2/src/alphaforge/operator_console/static/app.js +5057 -0
- alphaforged-0.3.2/src/alphaforge/operator_console/static/index.html +620 -0
- alphaforged-0.3.2/src/alphaforge/operator_console/static/styles.css +4802 -0
- alphaforged-0.3.2/src/alphaforge/options/__init__.py +1 -0
- alphaforged-0.3.2/src/alphaforge/options/analytics.py +302 -0
- alphaforged-0.3.2/src/alphaforge/orchestration/__init__.py +3 -0
- alphaforged-0.3.2/src/alphaforge/orchestration/control_plane.py +149 -0
- alphaforged-0.3.2/src/alphaforge/portfolio/__init__.py +1 -0
- alphaforged-0.3.2/src/alphaforge/portfolio/correlation.py +258 -0
- alphaforged-0.3.2/src/alphaforge/portfolio/optimizer.py +259 -0
- alphaforged-0.3.2/src/alphaforge/regime/__init__.py +1 -0
- alphaforged-0.3.2/src/alphaforge/regime/detector.py +330 -0
- alphaforged-0.3.2/src/alphaforge/research/__init__.py +3 -0
- alphaforged-0.3.2/src/alphaforge/research/engine.py +71 -0
- alphaforged-0.3.2/src/alphaforge/risk/__init__.py +7 -0
- alphaforged-0.3.2/src/alphaforge/risk/circuit_breaker.py +217 -0
- alphaforged-0.3.2/src/alphaforge/risk/portfolio_risk.py +256 -0
- alphaforged-0.3.2/src/alphaforge/risk/position_sizer.py +206 -0
- alphaforged-0.3.2/src/alphaforge/risk/risk_manager.py +196 -0
- alphaforged-0.3.2/src/alphaforge/runtime/__init__.py +1 -0
- alphaforged-0.3.2/src/alphaforge/runtime/demo.py +109 -0
- alphaforged-0.3.2/src/alphaforge/runtime/forecast_history.py +376 -0
- alphaforged-0.3.2/src/alphaforge/runtime/forecast_monitor.py +881 -0
- alphaforged-0.3.2/src/alphaforge/runtime/free_tier_service.py +1690 -0
- alphaforged-0.3.2/src/alphaforge/runtime/universe_monitor.py +451 -0
- alphaforged-0.3.2/src/alphaforge/screening/__init__.py +5 -0
- alphaforged-0.3.2/src/alphaforge/screening/data_quality.py +184 -0
- alphaforged-0.3.2/src/alphaforge/screening/decimal_safety.py +173 -0
- alphaforged-0.3.2/src/alphaforge/screening/engine.py +1344 -0
- alphaforged-0.3.2/src/alphaforge/screening/morningstar.py +172 -0
- alphaforged-0.3.2/src/alphaforge/screening/quality.py +187 -0
- alphaforged-0.3.2/src/alphaforge/sentiment/__init__.py +34 -0
- alphaforged-0.3.2/src/alphaforge/sentiment/company.py +560 -0
- alphaforged-0.3.2/src/alphaforge/sentiment/finbert_scorer.py +127 -0
- alphaforged-0.3.2/src/alphaforge/sentiment/models.py +151 -0
- alphaforged-0.3.2/src/alphaforge/sentiment/pipeline.py +242 -0
- alphaforged-0.3.2/src/alphaforge/sentiment/scoring.py +136 -0
- alphaforged-0.3.2/src/alphaforge/sentiment/sector.py +144 -0
- alphaforged-0.3.2/src/alphaforge/sentiment/sector_map.py +141 -0
- alphaforged-0.3.2/src/alphaforge/sentiment/statistical.py +216 -0
- alphaforged-0.3.2/src/alphaforge/setup_wizard.py +292 -0
- alphaforged-0.3.2/src/alphaforge/visualization/__init__.py +1 -0
- alphaforged-0.3.2/src/alphaforge/visualization/chart_engine.py +297 -0
- alphaforged-0.3.2/src/alphaforged.egg-info/PKG-INFO +496 -0
- alphaforged-0.3.2/src/alphaforged.egg-info/SOURCES.txt +144 -0
- alphaforged-0.3.2/src/alphaforged.egg-info/dependency_links.txt +1 -0
- alphaforged-0.3.2/src/alphaforged.egg-info/entry_points.txt +2 -0
- alphaforged-0.3.2/src/alphaforged.egg-info/requires.txt +41 -0
- alphaforged-0.3.2/src/alphaforged.egg-info/top_level.txt +2 -0
- alphaforged-0.3.2/tests/test_alerts.py +122 -0
- alphaforged-0.3.2/tests/test_api_endpoints.py +76 -0
- alphaforged-0.3.2/tests/test_cli_smoke.py +67 -0
- alphaforged-0.3.2/tests/test_company_sentiment.py +63 -0
- alphaforged-0.3.2/tests/test_core.py +119 -0
- alphaforged-0.3.2/tests/test_explanation_smoke.py +135 -0
- alphaforged-0.3.2/tests/test_fastapi_migration.py +45 -0
- alphaforged-0.3.2/tests/test_finbert_scorer.py +64 -0
- alphaforged-0.3.2/tests/test_multilayer_integration.py +95 -0
- alphaforged-0.3.2/tests/test_portfolio.py +76 -0
- alphaforged-0.3.2/tests/test_provider_status.py +55 -0
- alphaforged-0.3.2/tests/test_sector_map.py +60 -0
- alphaforged-0.3.2/tests/test_sector_sentiment.py +81 -0
- alphaforged-0.3.2/tests/test_sentiment_models.py +117 -0
- alphaforged-0.3.2/tests/test_setup_wizard.py +49 -0
- alphaforged-0.3.2/tests/test_statistical.py +92 -0
- alphaforged-0.3.2/tests/test_stock_detail.py +106 -0
- alphaforged-0.3.2/tests/test_timesfm_verify.py +115 -0
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: alphaforged
|
|
3
|
+
Version: 0.3.2
|
|
4
|
+
Summary: Institutional-grade AI market intelligence and quantitative trading platform scaffold
|
|
5
|
+
Author: Soodkrish
|
|
6
|
+
Project-URL: Homepage, https://github.com/Soodkrish03/AlphaForge
|
|
7
|
+
Project-URL: Repository, https://github.com/Soodkrish03/AlphaForge
|
|
8
|
+
Project-URL: Issues, https://github.com/Soodkrish03/AlphaForge/issues
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: pydantic<3.0,>=2.7
|
|
12
|
+
Requires-Dist: vaderSentiment>=3.3
|
|
13
|
+
Requires-Dist: yfinance>=0.2.40
|
|
14
|
+
Requires-Dist: fastapi>=0.112
|
|
15
|
+
Requires-Dist: uvicorn>=0.30
|
|
16
|
+
Provides-Extra: data
|
|
17
|
+
Requires-Dist: pandas>=2.2; extra == "data"
|
|
18
|
+
Requires-Dist: polars>=1.1; extra == "data"
|
|
19
|
+
Requires-Dist: pyarrow>=17.0; extra == "data"
|
|
20
|
+
Requires-Dist: duckdb>=1.1; extra == "data"
|
|
21
|
+
Requires-Dist: httpx>=0.27; extra == "data"
|
|
22
|
+
Requires-Dist: redis>=5.0; extra == "data"
|
|
23
|
+
Provides-Extra: ml
|
|
24
|
+
Requires-Dist: numpy>=1.26; extra == "ml"
|
|
25
|
+
Requires-Dist: scipy>=1.13; extra == "ml"
|
|
26
|
+
Requires-Dist: scikit-learn>=1.5; extra == "ml"
|
|
27
|
+
Requires-Dist: xgboost>=2.1; extra == "ml"
|
|
28
|
+
Requires-Dist: lightgbm>=4.5; extra == "ml"
|
|
29
|
+
Requires-Dist: catboost>=1.2; extra == "ml"
|
|
30
|
+
Requires-Dist: torch>=2.4; extra == "ml"
|
|
31
|
+
Requires-Dist: transformers>=4.44; extra == "ml"
|
|
32
|
+
Requires-Dist: optuna>=3.6; extra == "ml"
|
|
33
|
+
Requires-Dist: timesfm>=1.0; extra == "ml"
|
|
34
|
+
Requires-Dist: google-genai>=1.0; extra == "ml"
|
|
35
|
+
Provides-Extra: api
|
|
36
|
+
Requires-Dist: fastapi>=0.112; extra == "api"
|
|
37
|
+
Requires-Dist: uvicorn>=0.30; extra == "api"
|
|
38
|
+
Requires-Dist: orjson>=3.10; extra == "api"
|
|
39
|
+
Provides-Extra: ui
|
|
40
|
+
Requires-Dist: streamlit>=1.38; extra == "ui"
|
|
41
|
+
Requires-Dist: plotly>=5.24; extra == "ui"
|
|
42
|
+
Provides-Extra: ops
|
|
43
|
+
Requires-Dist: sqlalchemy>=2.0; extra == "ops"
|
|
44
|
+
Requires-Dist: alembic>=1.13; extra == "ops"
|
|
45
|
+
Requires-Dist: prometheus-client>=0.20; extra == "ops"
|
|
46
|
+
Requires-Dist: structlog>=24.4; extra == "ops"
|
|
47
|
+
|
|
48
|
+
# Ξ± AlphaForge
|
|
49
|
+
|
|
50
|
+
### AI-Powered Market Intelligence & Quantitative Trading Platform
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
<div align="center">
|
|
54
|
+
|
|
55
|
+

|
|
56
|
+

|
|
57
|
+

|
|
58
|
+

|
|
59
|
+
|
|
60
|
+
**Institutional-grade scaffold for cross-asset prediction, risk-aware signal generation, continual learning, and human-readable decision support.**
|
|
61
|
+
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## π― What is AlphaForge?
|
|
67
|
+
|
|
68
|
+
AlphaForge is an **institutional-grade scaffold** for an AI-powered market intelligence and quantitative trading platform. It is designed as a **research-to-production operating system** for:
|
|
69
|
+
|
|
70
|
+
- **Cross-asset prediction** β Equities, crypto, futures, and derivatives
|
|
71
|
+
- **Risk-aware signal generation** β Volatility-adjusted sizing, drawdown protection
|
|
72
|
+
- **Continual learning** β Adaptive regime detection, model retraining pipelines
|
|
73
|
+
- **Human-readable decision support** β Explainable signals, not black boxes
|
|
74
|
+
|
|
75
|
+
> **Built for traders who want to understand *why* a signal fires, not just *that* it fires.**
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## πΌοΈ Screenshots
|
|
80
|
+
|
|
81
|
+
<div align="center">
|
|
82
|
+
|
|
83
|
+
### π Full Dashboard View
|
|
84
|
+
|
|
85
|
+
> <!-- Add image link here: assets/s look.png -->
|
|
86
|
+
>
|
|
87
|
+
> 
|
|
88
|
+
>
|
|
89
|
+
> *Real-time market data, watchlist, macro indicators, and stock analysis in one unified view*
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
### π Detailed Stock Analysis
|
|
94
|
+
|
|
95
|
+
> <!-- Add image link here: assets/f look.png -->
|
|
96
|
+
>
|
|
97
|
+
> 
|
|
98
|
+
>
|
|
99
|
+
> *Deep dive into individual stocks with risk assessment, insider trading, and earnings data*
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### π¨ UI Highlights
|
|
104
|
+
|
|
105
|
+
| Feature | Preview |
|
|
106
|
+
|---------|---------|
|
|
107
|
+
| **API Quota Monitor** | <!-- Add GIF/screenshot here --> `Hover over API section` |
|
|
108
|
+
| **Smart Watchlist** | <!-- Add GIF/screenshot here --> `Add/remove with optimistic UI` |
|
|
109
|
+
| **Stock Screener** | <!-- Add GIF/screenshot here --> `Multi-factor filtering` |
|
|
110
|
+
| **Alert System** | <!-- Add GIF/screenshot here --> `Real-time notifications` |
|
|
111
|
+
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<div align="center">
|
|
115
|
+
|
|
116
|
+
> πΈ **Want to add more screenshots?** Place images in the `assets/` folder and reference them above.
|
|
117
|
+
>
|
|
118
|
+
> Supported formats: `.png`, `.jpg`, `.gif`, `.webp`
|
|
119
|
+
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## π Installation
|
|
125
|
+
|
|
126
|
+
### Prerequisites
|
|
127
|
+
|
|
128
|
+
| Requirement | Version |
|
|
129
|
+
|-------------|---------|
|
|
130
|
+
| **Python** | 3.11+ |
|
|
131
|
+
|
|
132
|
+
### Quick Install (PyPI)
|
|
133
|
+
|
|
134
|
+
```powershell
|
|
135
|
+
pip install alphaforge
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
That's it. One command installs:
|
|
139
|
+
- Core package (pydantic models, risk engine, backtesting, research tournament)
|
|
140
|
+
- Operator console web app (FastAPI + static HTML/JS/CSS)
|
|
141
|
+
- CLI entry point
|
|
142
|
+
|
|
143
|
+
### Launch
|
|
144
|
+
|
|
145
|
+
```powershell
|
|
146
|
+
# Start the operator console
|
|
147
|
+
alphaforge serve
|
|
148
|
+
|
|
149
|
+
# Custom port
|
|
150
|
+
alphaforge serve --port 9000
|
|
151
|
+
|
|
152
|
+
# Run demo pipeline
|
|
153
|
+
alphaforge demo
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Open `http://localhost:8765` in your browser.
|
|
157
|
+
|
|
158
|
+
### First-Time Setup
|
|
159
|
+
|
|
160
|
+
Create a `.env` file in your working directory:
|
|
161
|
+
|
|
162
|
+
```env
|
|
163
|
+
ALPHA_VANTAGE_API_KEY=your_key_here
|
|
164
|
+
FRED_API_KEY=your_key_here
|
|
165
|
+
FINNHUB_API_KEY=optional
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Get free keys:
|
|
169
|
+
- [Alpha Vantage](https://www.alphavantage.co/support/#api-key) β 25 req/day
|
|
170
|
+
- [FRED](https://fred.stlouisfed.org/docs/api/api_key.html) β Unlimited
|
|
171
|
+
- [Finnhub](https://finnhub.io/) β 60 req/min (optional)
|
|
172
|
+
|
|
173
|
+
### Install with All Dependencies
|
|
174
|
+
|
|
175
|
+
```powershell
|
|
176
|
+
# Full install (ML, data, API, UI, ops)
|
|
177
|
+
pip install "alphaforge[all]"
|
|
178
|
+
|
|
179
|
+
# Or specific groups
|
|
180
|
+
pip install "alphaforge[ml]" # PyTorch, scikit-learn, XGBoost
|
|
181
|
+
pip install "alphaforge[data]" # Pandas, Polars, DuckDB
|
|
182
|
+
pip install "alphaforge[api]" # FastAPI, Uvicorn
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Development Install (from source)
|
|
186
|
+
|
|
187
|
+
```powershell
|
|
188
|
+
# Clone the repo
|
|
189
|
+
git clone https://github.com/Soodkrish03/alphaforge.git
|
|
190
|
+
cd alphaforge
|
|
191
|
+
|
|
192
|
+
# uv reads .python-version + uv.lock β exact same Python + deps
|
|
193
|
+
uv sync --all-extras
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
`uv` automatically installs **Python 3.13.4** (pinned in `.python-version`) and all dependencies from `uv.lock`. No version mismatches, no "works on my machine."
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## βοΈ Configuration
|
|
201
|
+
|
|
202
|
+
### Environment Variables (`.env`)
|
|
203
|
+
|
|
204
|
+
| Variable | Required | Description |
|
|
205
|
+
|----------|----------|-------------|
|
|
206
|
+
| `ALPHA_VANTAGE_API_KEY` | β
| Stock data, fundamentals, news sentiment |
|
|
207
|
+
| `FRED_API_KEY` | β
| Macroeconomic indicators |
|
|
208
|
+
| `FINNHUB_API_KEY` | β | Near-realtime US stock quotes |
|
|
209
|
+
|
|
210
|
+
### Platform Config (`configs/platform.toml`)
|
|
211
|
+
|
|
212
|
+
```toml
|
|
213
|
+
[risk]
|
|
214
|
+
max_gross_exposure = 2.5
|
|
215
|
+
max_drawdown_pct = 12.0
|
|
216
|
+
volatility_target_pct = 14.0
|
|
217
|
+
|
|
218
|
+
[research]
|
|
219
|
+
walk_forward_windows = 12
|
|
220
|
+
stress_paths = 5000
|
|
221
|
+
tournament_size = 128
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## ποΈ Architecture
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
230
|
+
β OPERATOR CONSOLE GUI β
|
|
231
|
+
β Real-time Dashboard β Watchlist β Screener β Alerts β Portfolio β Macros β
|
|
232
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
233
|
+
β API LAYER β
|
|
234
|
+
β FastAPI REST β WebSocket Streams β gRPC (planned) β Kafka Events β
|
|
235
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
236
|
+
β ORCHESTRATION ENGINE β
|
|
237
|
+
β Async Control Plane β Regime Detection β Model Retraining β Alert Routing β
|
|
238
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
239
|
+
β RESEARCH TOURNAMENT β
|
|
240
|
+
β Alpha Factor Ranking β Walk-Forward Validation β Model Comparison β
|
|
241
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
242
|
+
β RISK ENGINE β
|
|
243
|
+
β Volatility Sizing β Drawdown Brakes β Kelly Scaling β Position Limits β
|
|
244
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
245
|
+
β ML PIPELINE β
|
|
246
|
+
β LSTM β Transformer β XGBoost β Ensemble β Regime Classifier β
|
|
247
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
248
|
+
β FEATURE STORE β
|
|
249
|
+
β Feast Integration β Time-Series Features β Cross-Asset Signals β
|
|
250
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
251
|
+
β DATA LAYER β
|
|
252
|
+
β yfinance β Alpha Vantage β FRED β Finnhub β Google News RSS β Binance β
|
|
253
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## β¨ Features
|
|
259
|
+
|
|
260
|
+
### π Operator Console (Live)
|
|
261
|
+
|
|
262
|
+
| Feature | Description |
|
|
263
|
+
|---------|-------------|
|
|
264
|
+
| **Real-Time Dashboard** | Live market data, charts, and portfolio overview |
|
|
265
|
+
| **Smart Watchlist** | Add/remove symbols with optimistic UI updates |
|
|
266
|
+
| **Stock Screener** | Multi-factor screening with sector/industry filters |
|
|
267
|
+
| **Alert System** | Volatility, sentiment, regime, and liquidity alerts |
|
|
268
|
+
| **API Quota Monitor** | Live tracking of Finnhub (60 req/min) and Alpha Vantage (25 req/day) |
|
|
269
|
+
| **Market Movers** | Top gainers, losers, most active stocks |
|
|
270
|
+
| **Macro Panel** | Fed funds rate, unemployment, yield curve, consumer sentiment |
|
|
271
|
+
| **Insider Trading** | Real-time insider transactions from SEC filings |
|
|
272
|
+
| **Earnings Calendar** | Upcoming earnings dates and estimates |
|
|
273
|
+
| **Crypto Dashboard** | Fear & Greed Index, funding rates, on-chain metrics |
|
|
274
|
+
|
|
275
|
+
### π§ Core Engine
|
|
276
|
+
|
|
277
|
+
| Module | Purpose |
|
|
278
|
+
|--------|---------|
|
|
279
|
+
| `alphaforge.domain` | Pure data structures (TradePlan, RiskSnapshot, ModelPrediction) |
|
|
280
|
+
| `alphaforge.models` | ML abstractions (BaseModel ABC, RegimeClassifier, EnsembleModel) |
|
|
281
|
+
| `alphaforge.features` | Feast feature store wrapper with time-series support |
|
|
282
|
+
| `alphaforge.execution` | RiskEngine, AlertEvent generation, position sizing |
|
|
283
|
+
| `alphaforge.backtesting` | Deterministic simulation from TradePlan signals |
|
|
284
|
+
| `alphaforge.research` | Experiment runner β IntelligenceReport with factor ranking |
|
|
285
|
+
| `alphaforge.orchestration` | Async ControlPlane scheduling risk/model updates |
|
|
286
|
+
| `alphaforge.runtime` | Demo entry point, UniverseMonitorService, FreeTierReportService |
|
|
287
|
+
|
|
288
|
+
### π‘οΈ Risk Management
|
|
289
|
+
|
|
290
|
+
```python
|
|
291
|
+
# Automatic risk checks before every trade
|
|
292
|
+
RiskEngine.evaluate(
|
|
293
|
+
trade_plan=plan,
|
|
294
|
+
portfolio=portfolio,
|
|
295
|
+
market_regime=current_regime,
|
|
296
|
+
)
|
|
297
|
+
# β Returns approved/rejected with explanation
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
- **Volatility-aware sizing** β Position size inversely proportional to IV
|
|
301
|
+
- **Drawdown protection** β Automatic halting at configurable thresholds
|
|
302
|
+
- **Kelly criterion scaling** β Optimal bet sizing based on edge/volatility
|
|
303
|
+
- **Regime-adaptive limits** β Tighter constraints in bear markets
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## π Project Structure
|
|
308
|
+
|
|
309
|
+
```
|
|
310
|
+
C:\VScode\ALGO
|
|
311
|
+
β
|
|
312
|
+
βββ π± apps\operator_console\ # Live web dashboard
|
|
313
|
+
β βββ index.html # Main UI (single-page app)
|
|
314
|
+
β βββ app.js # All UI logic, charts, API calls
|
|
315
|
+
β βββ styles.css # Professional dark theme
|
|
316
|
+
β βββ server.py # FastAPI server with REST endpoints
|
|
317
|
+
β
|
|
318
|
+
βββ πΌοΈ assets\ # Screenshots, images, demo files
|
|
319
|
+
β βββ s look.png # Dashboard screenshot
|
|
320
|
+
β βββ f look.png # Stock analysis screenshot
|
|
321
|
+
β
|
|
322
|
+
βββ π§ src\alphaforge\ # Core platform package
|
|
323
|
+
β βββ domain\models.py # Typed data structures
|
|
324
|
+
β βββ models\ # ML model abstractions
|
|
325
|
+
β βββ features\ # Feature store wrapper
|
|
326
|
+
β βββ execution\risk_engine.py # Risk evaluation & sizing
|
|
327
|
+
β βββ execution\alerts.py # Alert generation
|
|
328
|
+
β βββ backtesting\engine.py # Deterministic simulation
|
|
329
|
+
β βββ research\ # Experiment runner
|
|
330
|
+
β βββ orchestration\control_plane.py # Async orchestrator
|
|
331
|
+
β βββ data\free_market_data.py # Free API connectors
|
|
332
|
+
β βββ runtime\ # Services & demo entry
|
|
333
|
+
β
|
|
334
|
+
βββ π configs\platform.toml # Platform defaults
|
|
335
|
+
βββ π data\universes\ # Symbol universes (CSV)
|
|
336
|
+
βββ π§ͺ tests\ # Deterministic unit tests
|
|
337
|
+
βββ π docs\ # Architecture & wireframes
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## π Data Sources
|
|
343
|
+
|
|
344
|
+
### Free Tier (No API Key Required)
|
|
345
|
+
|
|
346
|
+
| Provider | Data | Rate Limit |
|
|
347
|
+
|----------|------|------------|
|
|
348
|
+
| **yfinance** | Prices, fundamentals, insider transactions, earnings | Unlimited* |
|
|
349
|
+
| **Google News RSS** | News sentiment for stocks | Unlimited |
|
|
350
|
+
| **alternative.me** | Crypto Fear & Greed Index | Unlimited |
|
|
351
|
+
| **Binance** | Crypto perpetual funding rates | Unlimited |
|
|
352
|
+
| **blockchain.com** | BTC on-chain metrics (hashrate, mempool) | Unlimited |
|
|
353
|
+
|
|
354
|
+
*yfinance uses unofficial Yahoo Finance endpoints β may be rate-limited during high traffic.
|
|
355
|
+
|
|
356
|
+
### Free Tier (API Key Required)
|
|
357
|
+
|
|
358
|
+
| Provider | Data | Rate Limit |
|
|
359
|
+
|----------|------|------------|
|
|
360
|
+
| **Alpha Vantage** | Daily prices, fundamentals, news sentiment, market movers | 25 requests/day |
|
|
361
|
+
| **FRED** | Macro indicators (Fed funds, unemployment, yields, consumer sentiment) | Unlimited |
|
|
362
|
+
| **Finnhub** | Near-realtime US stock quotes | 60 requests/min |
|
|
363
|
+
|
|
364
|
+
### Indian Market Support
|
|
365
|
+
|
|
366
|
+
AlphaForge is optimized for Indian equities:
|
|
367
|
+
- Automatic `.NS` / `.BO` suffix handling for NSE / BSE symbols
|
|
368
|
+
- INR currency detection and display
|
|
369
|
+
- Reliance, TCS, Infosys, HDFC β all work out of the box
|
|
370
|
+
- Macro panel includes USD/INR exchange rate
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
## π§ͺ Testing
|
|
375
|
+
|
|
376
|
+
```powershell
|
|
377
|
+
alphaforge demo
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
## πΊοΈ Roadmap
|
|
383
|
+
|
|
384
|
+
### Phase 1: Core Platform β
|
|
385
|
+
- [x] Typed domain model (Pydantic v2)
|
|
386
|
+
- [x] Free-tier data connectors (yfinance, Alpha Vantage, FRED, Finnhub)
|
|
387
|
+
- [x] Risk engine with volatility sizing and drawdown protection
|
|
388
|
+
- [x] Operator console with live dashboard
|
|
389
|
+
- [x] Smart watchlist with optimistic UI updates
|
|
390
|
+
- [x] Market screener with multi-factor filtering
|
|
391
|
+
|
|
392
|
+
### Phase 2: ML Pipeline π§
|
|
393
|
+
- [ ] LSTM/Transformer price prediction models
|
|
394
|
+
- [ ] Sentiment analysis with FinBERT
|
|
395
|
+
- [ ] Regime detection with Hidden Markov Models
|
|
396
|
+
- [ ] Ensemble model with dynamic weighting
|
|
397
|
+
- [ ] Walk-forward validation framework
|
|
398
|
+
|
|
399
|
+
### Phase 3: Production Systems π
|
|
400
|
+
- [ ] FastAPI REST + WebSocket server
|
|
401
|
+
- [ ] Kafka event streaming
|
|
402
|
+
- [ ] PostgreSQL feature store
|
|
403
|
+
- [ ] Redis caching layer
|
|
404
|
+
- [ ] Docker/Kubernetes deployment
|
|
405
|
+
|
|
406
|
+
### Phase 4: Advanced Features π
|
|
407
|
+
- [ ] Multi-broker execution (Zerodha, IBKR, Alpaca)
|
|
408
|
+
- [ ] Options pricing (Black-Scholes, binomial)
|
|
409
|
+
- [ ] Crypto perpetual futures trading
|
|
410
|
+
- [ ] Portfolio optimization (Markowitz, Black-Litterman)
|
|
411
|
+
- [ ] Regulatory compliance (SEBI, SEC)
|
|
412
|
+
|
|
413
|
+
---
|
|
414
|
+
|
|
415
|
+
## π Deployment: Publish to PyPI
|
|
416
|
+
|
|
417
|
+
### 1. Update Version
|
|
418
|
+
|
|
419
|
+
Edit `pyproject.toml`:
|
|
420
|
+
```toml
|
|
421
|
+
version = "0.2.0"
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### 2. Build & Upload
|
|
425
|
+
|
|
426
|
+
```powershell
|
|
427
|
+
pip install build twine
|
|
428
|
+
python -m build
|
|
429
|
+
twine upload dist/*
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
### 3. Tag Release
|
|
433
|
+
|
|
434
|
+
```powershell
|
|
435
|
+
git tag -a v0.2.0 -m "Release v0.2.0"
|
|
436
|
+
git push origin v0.2.0
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
---
|
|
440
|
+
|
|
441
|
+
## π Documentation
|
|
442
|
+
|
|
443
|
+
| Document | Description |
|
|
444
|
+
|----------|-------------|
|
|
445
|
+
| `docs/architecture.md` | Deep architecture dossier |
|
|
446
|
+
| `docs/gui_wireframes.md` | UI wireframes and design specs |
|
|
447
|
+
| `CLAUDE.md` | Claude Code integration guide |
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
## π€ Contributing
|
|
452
|
+
|
|
453
|
+
AlphaForge is currently in **private development**. For inquiries:
|
|
454
|
+
|
|
455
|
+
- Open an issue for bugs or feature requests
|
|
456
|
+
- Submit PRs for improvements (will be reviewed)
|
|
457
|
+
|
|
458
|
+
---
|
|
459
|
+
|
|
460
|
+
## π License
|
|
461
|
+
|
|
462
|
+
Proprietary β All rights reserved.
|
|
463
|
+
|
|
464
|
+
---
|
|
465
|
+
|
|
466
|
+
## π Acknowledgments
|
|
467
|
+
|
|
468
|
+
Built with:
|
|
469
|
+
- **Pydantic v2** β Data validation and settings management
|
|
470
|
+
- **yfinance** β Free market data (Yahoo Finance)
|
|
471
|
+
- **Alpha Vantage** β Free stock data API
|
|
472
|
+
- **FRED** β Federal Reserve Economic Data
|
|
473
|
+
- **Finnhub** β Real-time stock quotes
|
|
474
|
+
|
|
475
|
+
---
|
|
476
|
+
|
|
477
|
+
## π Troubleshooting
|
|
478
|
+
|
|
479
|
+
| Issue | Solution |
|
|
480
|
+
|-------|----------|
|
|
481
|
+
| `FileNotFoundError: .env` | Create `.env` file from `.env.example` with your API keys |
|
|
482
|
+
| `ConnectionError` when fetching data | Check internet connection; yfinance requires stable connection |
|
|
483
|
+
| `RateLimitError` from Alpha Vantage | You've exceeded 25 requests/day; wait 24h or upgrade plan |
|
|
484
|
+
| Server won't start on port 8765 | Another process is using the port; try `--port 9000` |
|
|
485
|
+
|
|
486
|
+
---
|
|
487
|
+
|
|
488
|
+
<div align="center">
|
|
489
|
+
|
|
490
|
+
**AlphaForge** β *Where quantitative research meets production trading.i think*
|
|
491
|
+
|
|
492
|
+
[](https://github.com/Soodkrish03/alphaforge)
|
|
493
|
+
[](https://python.org)
|
|
494
|
+
[](https://pydantic.dev)
|
|
495
|
+
|
|
496
|
+
</div>
|