Architecture Docker (8 services), FastAPI, TimescaleDB, Redis, Streamlit. Stratégies : scalping, intraday, swing. MLEngine + RegimeDetector (HMM). BacktestEngine + WalkForwardAnalyzer + Optuna optimizer. Routes API complètes dont /optimize async. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
346 lines
13 KiB
Markdown
346 lines
13 KiB
Markdown
# 🌳 Arborescence du Projet - Trading AI Secure
|
|
|
|
## 📁 Structure Actuelle (Documentation Complète)
|
|
|
|
```
|
|
trading_ai_secure/
|
|
│
|
|
├── 📄 README.md # Vue d'ensemble du projet
|
|
├── 📄 LICENSE # Licence MIT + Disclaimer
|
|
├── 📄 QUICK_START.md # Démarrage rapide (5 min)
|
|
├── 📄 DOCUMENTATION_INDEX.md # Index de toute la documentation
|
|
├── 📄 FILES_CREATED.md # Liste des fichiers créés
|
|
├── 📄 PROJECT_TREE.md # Ce fichier (arborescence)
|
|
├── 📄 requirements.txt # Dépendances Python
|
|
├── 📄 .gitignore # Fichiers à ignorer par Git
|
|
│
|
|
├── 📂 docs/ # Documentation détaillée
|
|
│ ├── 📄 GETTING_STARTED.md # Guide d'installation complet
|
|
│ ├── 📄 PROJECT_STATUS.md # État d'avancement détaillé
|
|
│ ├── 📄 ARCHITECTURE.md # Architecture technique
|
|
│ ├── 📄 AI_FRAMEWORK.md # Framework IA adaptative
|
|
│ ├── 📄 RISK_FRAMEWORK.md # Système de risk management
|
|
│ ├── 📄 STRATEGY_GUIDE.md # Guide des stratégies
|
|
│ ├── 📄 BACKTESTING_GUIDE.md # Guide backtesting
|
|
│ ├── 📄 IG_INTEGRATION.md # Intégration IG Markets
|
|
│ └── 📄 CONTRIBUTING.md # Guide de contribution
|
|
│
|
|
└── 📂 config/ # Fichiers de configuration
|
|
├── 📄 risk_limits.example.yaml # Template limites de risque
|
|
├── 📄 strategy_params.example.yaml # Template paramètres stratégies
|
|
└── 📄 data_sources.example.yaml # Template sources de données
|
|
```
|
|
|
|
---
|
|
|
|
## 🚧 Structure à Créer (Phase 1 - Semaines 1-2)
|
|
|
|
```
|
|
trading_ai_secure/
|
|
│
|
|
├── 📂 src/ # Code source principal
|
|
│ ├── 📄 __init__.py
|
|
│ ├── 📄 main.py # Point d'entrée principal
|
|
│ │
|
|
│ ├── 📂 core/ # Modules core
|
|
│ │ ├── 📄 __init__.py
|
|
│ │ ├── 📄 risk_manager.py # Risk Manager (Singleton)
|
|
│ │ ├── 📄 strategy_engine.py # Orchestrateur stratégies
|
|
│ │ ├── 📄 safety_layer.py # Circuit breakers
|
|
│ │ └── 📄 config_manager.py # Gestion configuration
|
|
│ │
|
|
│ ├── 📂 strategies/ # Stratégies de trading
|
|
│ │ ├── 📄 __init__.py
|
|
│ │ ├── 📄 base_strategy.py # Classe abstraite
|
|
│ │ │
|
|
│ │ ├── 📂 scalping/ # Stratégie scalping
|
|
│ │ │ ├── 📄 __init__.py
|
|
│ │ │ └── 📄 scalping_strategy.py
|
|
│ │ │
|
|
│ │ ├── 📂 intraday/ # Stratégie intraday
|
|
│ │ │ ├── 📄 __init__.py
|
|
│ │ │ └── 📄 intraday_strategy.py
|
|
│ │ │
|
|
│ │ └── 📂 swing/ # Stratégie swing
|
|
│ │ ├── 📄 __init__.py
|
|
│ │ └── 📄 swing_strategy.py
|
|
│ │
|
|
│ ├── 📂 data/ # Connecteurs de données
|
|
│ │ ├── 📄 __init__.py
|
|
│ │ ├── 📄 data_service.py # Service unifié
|
|
│ │ ├── 📄 ig_connector.py # Connecteur IG Markets
|
|
│ │ ├── 📄 ig_streaming.py # Streaming Lightstreamer
|
|
│ │ ├── 📄 free_sources.py # Sources gratuites
|
|
│ │ ├── 📄 data_validator.py # Validation données
|
|
│ │ └── 📄 cache_manager.py # Gestion cache Redis
|
|
│ │
|
|
│ ├── 📂 ml/ # Machine Learning
|
|
│ │ ├── 📄 __init__.py
|
|
│ │ ├── 📄 ml_engine.py # Moteur ML principal
|
|
│ │ ├── 📄 risk_aware_models.py # Modèles ML avec risk
|
|
│ │ ├── 📄 regime_detection.py # Détection régimes marché
|
|
│ │ ├── 📄 position_sizing.py # Sizing adaptatif
|
|
│ │ ├── 📄 feature_engineering.py # Engineering features
|
|
│ │ └── 📄 model_optimizer.py # Optimisation Optuna
|
|
│ │
|
|
│ ├── 📂 backtesting/ # Framework backtesting
|
|
│ │ ├── 📄 __init__.py
|
|
│ │ ├── 📄 backtest_engine.py # Moteur backtesting
|
|
│ │ ├── 📄 walk_forward.py # Walk-forward analysis
|
|
│ │ ├── 📄 monte_carlo.py # Simulation Monte Carlo
|
|
│ │ ├── 📄 paper_trading.py # Paper trading engine
|
|
│ │ └── 📄 metrics_calculator.py # Calcul métriques
|
|
│ │
|
|
│ ├── 📂 ui/ # Interface utilisateur
|
|
│ │ ├── 📄 __init__.py
|
|
│ │ ├── 📄 dashboard.py # Dashboard Streamlit
|
|
│ │ ├── 📄 risk_dashboard.py # Dashboard risk
|
|
│ │ ├── 📄 strategy_monitor.py # Monitoring stratégies
|
|
│ │ └── 📄 components.py # Composants UI réutilisables
|
|
│ │
|
|
│ ├── 📂 monitoring/ # Monitoring et alertes
|
|
│ │ ├── 📄 __init__.py
|
|
│ │ ├── 📄 metrics_collector.py # Collecte métriques
|
|
│ │ ├── 📄 alert_manager.py # Gestion alertes
|
|
│ │ ├── 📄 telegram_bot.py # Bot Telegram
|
|
│ │ └── 📄 email_notifier.py # Notifications email
|
|
│ │
|
|
│ └── 📂 utils/ # Utilitaires
|
|
│ ├── 📄 __init__.py
|
|
│ ├── 📄 logger.py # Configuration logging
|
|
│ ├── 📄 helpers.py # Fonctions helper
|
|
│ └── 📄 validators.py # Validateurs
|
|
│
|
|
├── 📂 tests/ # Tests
|
|
│ ├── 📄 __init__.py
|
|
│ ├── 📄 conftest.py # Configuration pytest
|
|
│ │
|
|
│ ├── 📂 unit/ # Tests unitaires
|
|
│ │ ├── 📄 __init__.py
|
|
│ │ ├── 📄 test_risk_manager.py
|
|
│ │ ├── 📄 test_strategies.py
|
|
│ │ ├── 📄 test_ml_engine.py
|
|
│ │ └── 📄 test_data_service.py
|
|
│ │
|
|
│ ├── 📂 integration/ # Tests d'intégration
|
|
│ │ ├── 📄 __init__.py
|
|
│ │ ├── 📄 test_data_sources.py
|
|
│ │ ├── 📄 test_ig_api.py
|
|
│ │ └── 📄 test_backtesting.py
|
|
│ │
|
|
│ ├── 📂 e2e/ # Tests end-to-end
|
|
│ │ ├── 📄 __init__.py
|
|
│ │ └── 📄 test_full_trading_loop.py
|
|
│ │
|
|
│ └── 📂 fixtures/ # Fixtures de test
|
|
│ ├── 📄 __init__.py
|
|
│ ├── 📄 sample_data.py
|
|
│ └── 📄 mock_responses.py
|
|
│
|
|
├── 📂 scripts/ # Scripts utilitaires
|
|
│ ├── 📄 setup_environment.sh # Setup environnement
|
|
│ ├── 📄 download_data.py # Téléchargement données
|
|
│ ├── 📄 optimize_strategies.py # Optimisation stratégies
|
|
│ └── 📄 deploy.sh # Script déploiement
|
|
│
|
|
├── 📂 notebooks/ # Jupyter notebooks
|
|
│ ├── 📄 01_data_exploration.ipynb
|
|
│ ├── 📄 02_strategy_development.ipynb
|
|
│ ├── 📄 03_ml_experiments.ipynb
|
|
│ └── 📄 04_backtesting_analysis.ipynb
|
|
│
|
|
├── 📂 examples/ # Exemples
|
|
│ ├── 📂 strategies/
|
|
│ │ └── 📄 custom_strategy_example.py
|
|
│ ├── 📂 backtests/
|
|
│ │ └── 📄 simple_backtest_example.py
|
|
│ └── 📂 configs/
|
|
│ └── 📄 minimal_config_example.yaml
|
|
│
|
|
├── 📂 data/ # Données (généré, gitignored)
|
|
│ ├── 📂 historical/ # Données historiques
|
|
│ ├── 📂 cache/ # Cache données
|
|
│ ├── 📂 backtest_results/ # Résultats backtests
|
|
│ └── 📂 models/ # Modèles ML sauvegardés
|
|
│
|
|
├── 📂 logs/ # Logs (généré, gitignored)
|
|
│ ├── 📄 trading.log
|
|
│ ├── 📄 errors.log
|
|
│ └── 📄 performance.log
|
|
│
|
|
├── 📂 docker/ # Configuration Docker
|
|
│ ├── 📄 Dockerfile
|
|
│ ├── 📄 docker-compose.yml
|
|
│ └── 📄 docker-compose.prod.yml
|
|
│
|
|
└── 📂 deployment/ # Déploiement
|
|
├── 📂 kubernetes/
|
|
│ ├── 📄 deployment.yaml
|
|
│ └── 📄 service.yaml
|
|
└── 📂 terraform/
|
|
└── 📄 main.tf
|
|
```
|
|
|
|
---
|
|
|
|
## 📊 Statistiques du Projet
|
|
|
|
### Fichiers Actuels (Documentation)
|
|
|
|
| Type | Nombre | Statut |
|
|
|------|--------|--------|
|
|
| Documentation principale | 10 | ✅ Créé |
|
|
| Configuration (templates) | 3 | ✅ Créé |
|
|
| Guides | 3 | ✅ Créé |
|
|
| Fichiers techniques | 2 | ✅ Créé |
|
|
| Légal | 1 | ✅ Créé |
|
|
| **TOTAL** | **19** | **✅ Complet** |
|
|
|
|
### Fichiers à Créer (Phase 1)
|
|
|
|
| Type | Nombre | Statut |
|
|
|------|--------|--------|
|
|
| Code source (src/) | ~30 | ⏳ À créer |
|
|
| Tests | ~15 | ⏳ À créer |
|
|
| Scripts | ~5 | ⏳ À créer |
|
|
| Notebooks | ~4 | ⏳ À créer |
|
|
| Exemples | ~3 | ⏳ À créer |
|
|
| Docker | ~3 | ⏳ À créer |
|
|
| **TOTAL** | **~60** | **⏳ Phase 1** |
|
|
|
|
---
|
|
|
|
## 🎯 Progression par Phase
|
|
|
|
### ✅ Phase 0 : Documentation (TERMINÉ)
|
|
- [x] README.md
|
|
- [x] Documentation complète (10 fichiers)
|
|
- [x] Configuration templates (3 fichiers)
|
|
- [x] Guides utilisateur (3 fichiers)
|
|
- [x] Fichiers techniques (2 fichiers)
|
|
|
|
### ⏳ Phase 1 : Architecture (Semaines 1-2)
|
|
- [ ] Structure src/ complète
|
|
- [ ] Modules core (risk_manager, strategy_engine)
|
|
- [ ] Connecteurs données (sources gratuites)
|
|
- [ ] Tests unitaires de base
|
|
- [ ] Configuration CI/CD
|
|
|
|
### 📅 Phase 2 : IA Adaptative (Semaines 3-4)
|
|
- [ ] ML Engine
|
|
- [ ] Regime detection
|
|
- [ ] Optimisation Optuna
|
|
- [ ] Position sizing adaptatif
|
|
|
|
### 📅 Phase 3 : Stratégies (Semaines 5-6)
|
|
- [ ] Scalping strategy
|
|
- [ ] Intraday strategy
|
|
- [ ] Swing strategy
|
|
- [ ] Backtesting framework
|
|
|
|
### 📅 Phase 4 : Interface (Semaines 7-8)
|
|
- [ ] Dashboard Streamlit
|
|
- [ ] Monitoring temps réel
|
|
- [ ] Système d'alertes
|
|
|
|
### 📅 Phase 5 : Production (Semaines 9-10)
|
|
- [ ] Intégration IG Markets
|
|
- [ ] Paper trading 30 jours
|
|
- [ ] Déploiement production
|
|
|
|
---
|
|
|
|
## 📝 Notes Importantes
|
|
|
|
### Fichiers Sensibles (Ne JAMAIS Commiter)
|
|
|
|
```
|
|
⚠️ ATTENTION - Ces fichiers contiennent des informations sensibles :
|
|
|
|
config/
|
|
├── risk_limits.yaml # Copier depuis .example
|
|
├── strategy_params.yaml # Copier depuis .example
|
|
├── data_sources.yaml # Copier depuis .example
|
|
└── ig_config.yaml # Créer manuellement
|
|
|
|
.env # Variables d'environnement
|
|
*.key # Clés API
|
|
*.pem # Certificats
|
|
secrets/ # Dossier secrets
|
|
credentials/ # Dossier credentials
|
|
```
|
|
|
|
### Dossiers Générés (Gitignored)
|
|
|
|
```
|
|
Ces dossiers seront créés automatiquement :
|
|
|
|
data/ # Données de trading
|
|
logs/ # Fichiers de logs
|
|
models/ # Modèles ML sauvegardés
|
|
.cache/ # Cache
|
|
__pycache__/ # Python cache
|
|
.pytest_cache/ # Pytest cache
|
|
htmlcov/ # Coverage reports
|
|
```
|
|
|
|
---
|
|
|
|
## 🚀 Commandes Utiles
|
|
|
|
### Visualiser l'Arborescence
|
|
|
|
```bash
|
|
# Windows (PowerShell)
|
|
tree /F
|
|
|
|
# Linux/macOS
|
|
tree -L 3
|
|
|
|
# Avec Python
|
|
pip install tree-format
|
|
tree-format .
|
|
```
|
|
|
|
### Compter les Fichiers
|
|
|
|
```bash
|
|
# Windows (PowerShell)
|
|
(Get-ChildItem -Recurse -File).Count
|
|
|
|
# Linux/macOS
|
|
find . -type f | wc -l
|
|
```
|
|
|
|
### Statistiques du Projet
|
|
|
|
```bash
|
|
# Lignes de code (sans node_modules, venv, etc.)
|
|
# Windows (PowerShell)
|
|
Get-ChildItem -Recurse -Include *.py,*.yaml,*.md | Get-Content | Measure-Object -Line
|
|
|
|
# Linux/macOS
|
|
find . -name "*.py" -o -name "*.yaml" -o -name "*.md" | xargs wc -l
|
|
```
|
|
|
|
---
|
|
|
|
## 📚 Légende
|
|
|
|
| Symbole | Signification |
|
|
|---------|---------------|
|
|
| 📄 | Fichier |
|
|
| 📂 | Dossier |
|
|
| ✅ | Créé et complet |
|
|
| ⏳ | À créer |
|
|
| 📅 | Planifié |
|
|
| ⚠️ | Attention/Important |
|
|
|
|
---
|
|
|
|
**Projet** : Trading AI Secure
|
|
**Version** : 0.1.0-alpha
|
|
**Date** : 2024-01-15
|
|
**Statut Documentation** : ✅ Complète (19 fichiers)
|
|
**Prochaine Étape** : Création structure src/ (Phase 1)
|