docs: mise à jour complète de la documentation (état réel 2026-03-08)
- PROJECT_STATUS.md : réécriture complète — phases 1-4b terminées à 100%, routes API exhaustives, fixes critiques documentés, à-faire priorisé - STRATEGY_GUIDE.md : ajout section ML-Driven Strategy avec features, labels, usage API et paramètres de configuration - AI_FRAMEWORK.md : ajout section ML-Driven + tableau statut implémentation, différenciation HMM/Optuna/MLStrategy - ARCHITECTURE.md : ajout structure réelle du code avec les nouveaux fichiers ml_strategy_model.py, features/, ml_driven/ annotés [NOUVEAU] Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -846,4 +846,88 @@ class SwingStrategy(BaseStrategy):
|
||||
|
||||
---
|
||||
|
||||
**Suite dans le prochain fichier...**
|
||||
## ML-Driven Strategy (Phase 4b — 2026-03-08)
|
||||
|
||||
### Concept
|
||||
|
||||
Contrairement aux stratégies règle-based (scalping/intraday/swing), la **MLDrivenStrategy** remplace
|
||||
les conditions codées en dur par un modèle XGBoost/LightGBM entraîné sur des données historiques.
|
||||
|
||||
Le modèle apprend **quelles combinaisons** d'indicateurs classiques sont réellement prédictives,
|
||||
reproduisant l'intuition d'un trader expérimenté.
|
||||
|
||||
### Fichiers
|
||||
| Fichier | Rôle |
|
||||
|---|---|
|
||||
| `src/strategies/ml_driven/ml_strategy.py` | Stratégie (interface BaseStrategy) |
|
||||
| `src/ml/ml_strategy_model.py` | Entraînement + prédiction |
|
||||
| `src/ml/features/technical_features.py` | ~50 features TA |
|
||||
| `src/ml/features/label_generator.py` | Labels LONG/SHORT/NEUTRAL |
|
||||
|
||||
Documentation complète : [docs/ML_STRATEGY_GUIDE.md](ML_STRATEGY_GUIDE.md)
|
||||
|
||||
### Features utilisées
|
||||
- **RSI** : valeur, zones survente/surachat, divergences haussières/baissières
|
||||
- **MACD** : crossovers, histogramme, pente du momentum
|
||||
- **Bollinger Bands** : position relative, squeeze, cassures et rebonds
|
||||
- **Supports/Résistances** : distance aux niveaux pivots locaux (50 barres)
|
||||
- **Points Pivots** : classiques (R1/R2/S1/S2) + Fibonacci (38.2%, 61.8%, 100%)
|
||||
- **ATR** : volatilité normalisée, ratio vs moyenne
|
||||
- **Chandeliers** : marteau, étoile filante, engulfing haussier/baissier, doji
|
||||
- **EMAs** : alignement 8/21/50/200, distance % du prix, pente
|
||||
- **Volume** : ratio vs moyenne, pics, OBV
|
||||
- **Sessions** : Londres (8h-16h), NY (13h-21h), chevauchement (13h-16h)
|
||||
|
||||
### Labels (supervision)
|
||||
Pour chaque barre i, simulation forward sur N barres :
|
||||
- **LONG (1)** : HIGH atteint `entry + tp_atr × ATR` avant que LOW descende sous `entry - sl_atr × ATR`
|
||||
- **SHORT (-1)** : l'inverse
|
||||
- **NEUTRAL (0)** : ni TP ni SL dans l'horizon
|
||||
|
||||
### Usage via API
|
||||
```bash
|
||||
# Entraîner
|
||||
curl -X POST http://localhost:8100/trading/train \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"symbol":"EURUSD","timeframe":"1h","period":"2y","model_type":"xgboost","tp_atr_mult":2.0,"sl_atr_mult":1.0}'
|
||||
|
||||
# Suivre l'entraînement
|
||||
curl http://localhost:8100/trading/train/{job_id}
|
||||
|
||||
# Lister les modèles disponibles
|
||||
curl http://localhost:8100/trading/ml-models
|
||||
|
||||
# Feature importance
|
||||
curl http://localhost:8100/trading/ml-models/EURUSD/1h/importance
|
||||
```
|
||||
|
||||
### Paramètres de configuration
|
||||
```python
|
||||
config = {
|
||||
'name': 'ml_driven',
|
||||
'symbol': 'EURUSD',
|
||||
'timeframe': '1h',
|
||||
'risk_per_trade': 0.01,
|
||||
'model_type': 'xgboost', # xgboost | lightgbm | random_forest
|
||||
'min_confidence': 0.55, # Seuil de confiance minimum
|
||||
'tp_atr_mult': 2.0, # TP = entry ± 2×ATR → R:R = 2:1
|
||||
'sl_atr_mult': 1.0, # SL = entry ∓ 1×ATR
|
||||
'auto_load': True, # Charge le modèle existant au démarrage
|
||||
}
|
||||
```
|
||||
|
||||
### Validation
|
||||
Walk-forward cross-validation (3 folds temporels) — protège contre l'overfitting.
|
||||
|
||||
Métriques cibles :
|
||||
- `wf_accuracy > 0.55`
|
||||
- `wf_precision > 0.50` sur signaux directionnels
|
||||
- Distribution LONG/SHORT équilibrée
|
||||
|
||||
### Modèles sauvegardés
|
||||
```
|
||||
models/ml_strategy/
|
||||
├── EURUSD_1h_xgboost.joblib
|
||||
└── EURUSD_1h_xgboost_meta.json
|
||||
```
|
||||
Chargement automatique au démarrage si `auto_load=True`.
|
||||
|
||||
Reference in New Issue
Block a user