Initial commit — Trading AI Secure project complet
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>
This commit is contained in:
477
config/strategy_params.example.yaml
Normal file
477
config/strategy_params.example.yaml
Normal file
@@ -0,0 +1,477 @@
|
||||
# Configuration Paramètres Stratégies - Trading AI Secure
|
||||
# Copier ce fichier vers strategy_params.yaml
|
||||
|
||||
# ============================================================================
|
||||
# CONFIGURATION GLOBALE STRATÉGIES
|
||||
# ============================================================================
|
||||
global_strategy_config:
|
||||
# Capital allocation par stratégie (doit totaliser 1.0)
|
||||
allocation:
|
||||
scalping: 0.30 # 30% du capital
|
||||
intraday: 0.50 # 50% du capital
|
||||
swing: 0.20 # 20% du capital
|
||||
|
||||
# Ajustement allocation selon régime de marché
|
||||
regime_based_allocation:
|
||||
enabled: true
|
||||
|
||||
bull_market:
|
||||
scalping: 0.20
|
||||
intraday: 0.50
|
||||
swing: 0.30 # Favoriser swing en bull
|
||||
|
||||
bear_market:
|
||||
scalping: 0.40 # Favoriser scalping en bear
|
||||
intraday: 0.40
|
||||
swing: 0.10
|
||||
short_bias: 0.10 # Activer short bias
|
||||
|
||||
sideways_market:
|
||||
scalping: 0.50 # Favoriser scalping en sideways
|
||||
intraday: 0.30
|
||||
swing: 0.20
|
||||
|
||||
# ============================================================================
|
||||
# STRATÉGIE SCALPING
|
||||
# ============================================================================
|
||||
scalping_strategy:
|
||||
# Informations générales
|
||||
name: "Scalping Mean Reversion"
|
||||
description: "Stratégie scalping basée sur retour à la moyenne"
|
||||
timeframe: "1min" # 1, 5 minutes
|
||||
enabled: true
|
||||
|
||||
# Indicateurs techniques
|
||||
indicators:
|
||||
bollinger_bands:
|
||||
period: 20
|
||||
std_dev: 2.0
|
||||
adaptive: true # Ajuster selon volatilité
|
||||
|
||||
rsi:
|
||||
period: 14
|
||||
oversold: 30
|
||||
overbought: 70
|
||||
adaptive: true # Ajuster seuils dynamiquement
|
||||
|
||||
macd:
|
||||
fast_period: 12
|
||||
slow_period: 26
|
||||
signal_period: 9
|
||||
|
||||
volume:
|
||||
ma_period: 20
|
||||
threshold_multiplier: 1.5 # Volume > 1.5x moyenne
|
||||
|
||||
atr:
|
||||
period: 14
|
||||
multiplier_stop: 2.0 # Stop-loss à 2 ATR
|
||||
multiplier_target: 3.0 # Take-profit à 3 ATR
|
||||
|
||||
# Conditions d'entrée
|
||||
entry_conditions:
|
||||
long:
|
||||
- "bb_position < 0.2" # Prix proche BB lower
|
||||
- "rsi < rsi_oversold" # RSI oversold
|
||||
- "macd_hist > 0" # MACD histogram positif
|
||||
- "volume_ratio > volume_threshold" # Volume confirmation
|
||||
- "confidence >= min_confidence" # Confiance suffisante
|
||||
|
||||
short:
|
||||
- "bb_position > 0.8" # Prix proche BB upper
|
||||
- "rsi > rsi_overbought" # RSI overbought
|
||||
- "macd_hist < 0" # MACD histogram négatif
|
||||
- "volume_ratio > volume_threshold"
|
||||
- "confidence >= min_confidence"
|
||||
|
||||
# Gestion de position
|
||||
position_management:
|
||||
entry_type: "market" # market, limit
|
||||
exit_type: "market" # market, limit
|
||||
use_trailing_stop: true
|
||||
trailing_stop_activation: 0.005 # Activer à +0.5%
|
||||
trailing_stop_distance: 0.003 # Distance 0.3%
|
||||
partial_take_profit: true
|
||||
partial_tp_levels:
|
||||
- level: 0.003 # 0.3%
|
||||
size: 0.5 # Fermer 50%
|
||||
- level: 0.005 # 0.5%
|
||||
size: 0.3 # Fermer 30%
|
||||
|
||||
# Filtres
|
||||
filters:
|
||||
time_filter:
|
||||
enabled: true
|
||||
trading_hours:
|
||||
- start: "08:00"
|
||||
end: "17:00"
|
||||
timezone: "Europe/London"
|
||||
|
||||
spread_filter:
|
||||
enabled: true
|
||||
max_spread_pct: 0.001 # 0.1% spread maximum
|
||||
|
||||
volatility_filter:
|
||||
enabled: true
|
||||
min_volatility: 0.005 # 0.5% minimum
|
||||
max_volatility: 0.03 # 3% maximum
|
||||
|
||||
# Optimisation adaptative
|
||||
adaptive_optimization:
|
||||
enabled: true
|
||||
optimization_frequency: "daily" # daily, weekly
|
||||
method: "bayesian" # bayesian, grid, random
|
||||
parameters_to_optimize:
|
||||
- "bb_period"
|
||||
- "bb_std"
|
||||
- "rsi_period"
|
||||
- "rsi_oversold"
|
||||
- "rsi_overbought"
|
||||
- "volume_threshold"
|
||||
- "min_confidence"
|
||||
|
||||
constraints:
|
||||
bb_period: [10, 30]
|
||||
bb_std: [1.5, 3.0]
|
||||
rsi_period: [10, 20]
|
||||
rsi_oversold: [20, 35]
|
||||
rsi_overbought: [65, 80]
|
||||
volume_threshold: [1.2, 2.0]
|
||||
min_confidence: [0.5, 0.8]
|
||||
|
||||
# ============================================================================
|
||||
# STRATÉGIE INTRADAY
|
||||
# ============================================================================
|
||||
intraday_strategy:
|
||||
# Informations générales
|
||||
name: "Intraday Trend Following"
|
||||
description: "Stratégie intraday suivant les tendances"
|
||||
timeframe: "15min" # 15, 30, 60 minutes
|
||||
enabled: true
|
||||
|
||||
# Indicateurs techniques
|
||||
indicators:
|
||||
ema:
|
||||
fast_period: 9
|
||||
slow_period: 21
|
||||
trend_period: 50
|
||||
adaptive: true
|
||||
|
||||
adx:
|
||||
period: 14
|
||||
threshold: 25 # ADX > 25 = tendance forte
|
||||
|
||||
atr:
|
||||
period: 14
|
||||
multiplier_stop: 2.5
|
||||
multiplier_target: 5.0 # R:R 2:1
|
||||
|
||||
volume:
|
||||
ma_period: 20
|
||||
confirmation_threshold: 1.2
|
||||
|
||||
pivot_points:
|
||||
type: "standard" # standard, fibonacci, camarilla
|
||||
lookback_period: 1 # 1 jour
|
||||
|
||||
# Conditions d'entrée
|
||||
entry_conditions:
|
||||
long:
|
||||
- "ema_fast > ema_slow" # EMA fast au-dessus slow
|
||||
- "ema_fast_prev <= ema_slow_prev" # Crossover récent
|
||||
- "close > ema_trend" # Prix au-dessus tendance
|
||||
- "adx > adx_threshold" # Tendance forte
|
||||
- "volume_ratio > volume_confirmation"
|
||||
- "confidence >= min_confidence"
|
||||
|
||||
short:
|
||||
- "ema_fast < ema_slow"
|
||||
- "ema_fast_prev >= ema_slow_prev"
|
||||
- "close < ema_trend"
|
||||
- "adx > adx_threshold"
|
||||
- "volume_ratio > volume_confirmation"
|
||||
- "confidence >= min_confidence"
|
||||
|
||||
# Gestion de position
|
||||
position_management:
|
||||
entry_type: "market"
|
||||
exit_type: "market"
|
||||
use_trailing_stop: true
|
||||
trailing_stop_activation: 0.01 # Activer à +1%
|
||||
trailing_stop_distance: 0.005 # Distance 0.5%
|
||||
partial_take_profit: true
|
||||
partial_tp_levels:
|
||||
- level: 0.01 # 1%
|
||||
size: 0.4 # Fermer 40%
|
||||
- level: 0.015 # 1.5%
|
||||
size: 0.3 # Fermer 30%
|
||||
|
||||
# Breakeven
|
||||
move_to_breakeven: true
|
||||
breakeven_trigger: 0.008 # À +0.8%
|
||||
breakeven_offset: 0.002 # +0.2% au-dessus entry
|
||||
|
||||
# Filtres
|
||||
filters:
|
||||
time_filter:
|
||||
enabled: true
|
||||
avoid_news_times: true # Éviter annonces économiques
|
||||
trading_sessions:
|
||||
- name: "London"
|
||||
start: "08:00"
|
||||
end: "16:30"
|
||||
- name: "New York"
|
||||
start: "13:30"
|
||||
end: "20:00"
|
||||
|
||||
trend_filter:
|
||||
enabled: true
|
||||
min_trend_strength: 0.6 # ADX normalisé
|
||||
|
||||
support_resistance_filter:
|
||||
enabled: true
|
||||
min_distance_from_sr: 0.005 # 0.5% distance minimum
|
||||
|
||||
# Optimisation adaptative
|
||||
adaptive_optimization:
|
||||
enabled: true
|
||||
optimization_frequency: "weekly"
|
||||
method: "bayesian"
|
||||
parameters_to_optimize:
|
||||
- "ema_fast"
|
||||
- "ema_slow"
|
||||
- "ema_trend"
|
||||
- "adx_threshold"
|
||||
- "atr_multiplier_stop"
|
||||
- "atr_multiplier_target"
|
||||
- "min_confidence"
|
||||
|
||||
constraints:
|
||||
ema_fast: [5, 15]
|
||||
ema_slow: [15, 30]
|
||||
ema_trend: [40, 60]
|
||||
adx_threshold: [20, 30]
|
||||
atr_multiplier_stop: [2.0, 3.5]
|
||||
atr_multiplier_target: [4.0, 6.0]
|
||||
min_confidence: [0.5, 0.75]
|
||||
|
||||
# ============================================================================
|
||||
# STRATÉGIE SWING
|
||||
# ============================================================================
|
||||
swing_strategy:
|
||||
# Informations générales
|
||||
name: "Swing Multi-Timeframe"
|
||||
description: "Stratégie swing avec analyse multi-timeframe"
|
||||
timeframe: "4h" # 4h, 1D
|
||||
enabled: true
|
||||
|
||||
# Indicateurs techniques
|
||||
indicators:
|
||||
sma:
|
||||
short_period: 20
|
||||
long_period: 50
|
||||
adaptive: true
|
||||
|
||||
rsi:
|
||||
period: 14
|
||||
neutral_zone: [40, 60] # Zone neutre pour swing
|
||||
|
||||
macd:
|
||||
fast_period: 12
|
||||
slow_period: 26
|
||||
signal_period: 9
|
||||
|
||||
fibonacci:
|
||||
lookback_period: 50 # 50 barres pour high/low
|
||||
key_levels: [0.236, 0.382, 0.5, 0.618, 0.786]
|
||||
|
||||
atr:
|
||||
period: 14
|
||||
multiplier_stop: 3.0
|
||||
multiplier_target: 6.0 # R:R 2:1
|
||||
|
||||
# Multi-timeframe analysis
|
||||
multi_timeframe:
|
||||
enabled: true
|
||||
higher_timeframe: "1D" # Timeframe supérieur
|
||||
confirm_trend: true # Confirmer tendance HTF
|
||||
|
||||
htf_indicators:
|
||||
- "sma_50"
|
||||
- "sma_200"
|
||||
- "trend_direction"
|
||||
|
||||
# Conditions d'entrée
|
||||
entry_conditions:
|
||||
long:
|
||||
- "sma_short > sma_long" # SMA short au-dessus long
|
||||
- "rsi >= 40 and rsi <= 60" # RSI zone neutre
|
||||
- "macd > macd_signal" # MACD bullish
|
||||
- "close_near_fib_support" # Prix près support Fibonacci
|
||||
- "htf_trend == 'UP'" # Tendance HTF haussière
|
||||
- "confidence >= min_confidence"
|
||||
|
||||
short:
|
||||
- "sma_short < sma_long"
|
||||
- "rsi >= 40 and rsi <= 60"
|
||||
- "macd < macd_signal"
|
||||
- "close_near_fib_resistance"
|
||||
- "htf_trend == 'DOWN'"
|
||||
- "confidence >= min_confidence"
|
||||
|
||||
# Gestion de position
|
||||
position_management:
|
||||
entry_type: "limit" # Limit orders pour meilleur prix
|
||||
entry_offset: 0.002 # 0.2% offset
|
||||
exit_type: "market"
|
||||
use_trailing_stop: true
|
||||
trailing_stop_activation: 0.02 # Activer à +2%
|
||||
trailing_stop_distance: 0.01 # Distance 1%
|
||||
partial_take_profit: true
|
||||
partial_tp_levels:
|
||||
- level: 0.03 # 3%
|
||||
size: 0.33 # Fermer 33%
|
||||
- level: 0.05 # 5%
|
||||
size: 0.33 # Fermer 33%
|
||||
|
||||
# Scale in
|
||||
scale_in: true
|
||||
scale_in_levels:
|
||||
- trigger: 0.01 # À +1%
|
||||
size: 0.5 # Ajouter 50% position initiale
|
||||
|
||||
# Filtres
|
||||
filters:
|
||||
fundamental_filter:
|
||||
enabled: true
|
||||
avoid_earnings: true # Éviter publications résultats
|
||||
avoid_major_news: true # Éviter news majeures
|
||||
|
||||
seasonal_filter:
|
||||
enabled: false # Optionnel
|
||||
favorable_months: [1, 2, 3, 10, 11, 12] # Mois favorables
|
||||
|
||||
correlation_filter:
|
||||
enabled: true
|
||||
max_correlation_with_existing: 0.7
|
||||
|
||||
# Optimisation adaptative
|
||||
adaptive_optimization:
|
||||
enabled: true
|
||||
optimization_frequency: "monthly"
|
||||
method: "bayesian"
|
||||
parameters_to_optimize:
|
||||
- "sma_short"
|
||||
- "sma_long"
|
||||
- "rsi_period"
|
||||
- "fibonacci_lookback"
|
||||
- "atr_multiplier_stop"
|
||||
- "min_confidence"
|
||||
|
||||
constraints:
|
||||
sma_short: [15, 25]
|
||||
sma_long: [40, 60]
|
||||
rsi_period: [10, 20]
|
||||
fibonacci_lookback: [30, 70]
|
||||
atr_multiplier_stop: [2.5, 4.0]
|
||||
min_confidence: [0.5, 0.7]
|
||||
|
||||
# ============================================================================
|
||||
# MACHINE LEARNING CONFIGURATION
|
||||
# ============================================================================
|
||||
ml_config:
|
||||
# Modèles utilisés
|
||||
models:
|
||||
- name: "xgboost"
|
||||
enabled: true
|
||||
priority: 1
|
||||
hyperparameters:
|
||||
n_estimators: 100
|
||||
max_depth: 6
|
||||
learning_rate: 0.1
|
||||
|
||||
- name: "lightgbm"
|
||||
enabled: true
|
||||
priority: 2
|
||||
hyperparameters:
|
||||
n_estimators: 100
|
||||
max_depth: 6
|
||||
learning_rate: 0.1
|
||||
|
||||
- name: "random_forest"
|
||||
enabled: false
|
||||
priority: 3
|
||||
hyperparameters:
|
||||
n_estimators: 100
|
||||
max_depth: 10
|
||||
|
||||
# Features engineering
|
||||
features:
|
||||
technical_indicators: true
|
||||
price_patterns: true
|
||||
volume_profile: true
|
||||
market_microstructure: false # Avancé
|
||||
sentiment_analysis: false # Nécessite API news
|
||||
|
||||
# Training
|
||||
training:
|
||||
train_test_split: 0.7 # 70% train, 30% test
|
||||
validation_method: "walk_forward" # walk_forward, k_fold
|
||||
retraining_frequency: "weekly" # daily, weekly, monthly
|
||||
min_samples: 1000 # Minimum échantillons
|
||||
|
||||
# Ensemble
|
||||
ensemble:
|
||||
enabled: true
|
||||
method: "stacking" # stacking, voting, blending
|
||||
meta_learner: "logistic_regression"
|
||||
|
||||
# ============================================================================
|
||||
# BACKTESTING CONFIGURATION
|
||||
# ============================================================================
|
||||
backtesting_config:
|
||||
# Données
|
||||
data:
|
||||
start_date: "2020-01-01"
|
||||
end_date: "2024-01-01"
|
||||
symbols: ["EURUSD", "GBPUSD", "USDJPY"]
|
||||
|
||||
# Coûts de transaction
|
||||
transaction_costs:
|
||||
commission_pct: 0.0001 # 0.01% commission
|
||||
slippage_pct: 0.0005 # 0.05% slippage
|
||||
spread_pct: 0.0002 # 0.02% spread
|
||||
|
||||
# Validation
|
||||
validation:
|
||||
walk_forward:
|
||||
enabled: true
|
||||
train_window: 252 # 1 an
|
||||
test_window: 63 # 3 mois
|
||||
step_size: 21 # 1 mois
|
||||
|
||||
monte_carlo:
|
||||
enabled: true
|
||||
n_simulations: 10000
|
||||
confidence_level: 0.95
|
||||
|
||||
out_of_sample:
|
||||
enabled: true
|
||||
oos_ratio: 0.30 # 30% out-of-sample
|
||||
|
||||
# Métriques
|
||||
metrics:
|
||||
required:
|
||||
sharpe_ratio: 1.5
|
||||
max_drawdown: 0.10
|
||||
win_rate: 0.55
|
||||
profit_factor: 1.3
|
||||
calmar_ratio: 0.5
|
||||
|
||||
# ============================================================================
|
||||
# NOTES
|
||||
# ============================================================================
|
||||
# 1. Tous les paramètres sont ADAPTATIFS par défaut
|
||||
# 2. L'IA ajustera ces valeurs quotidiennement/hebdomadairement
|
||||
# 3. Les contraintes définissent les limites d'optimisation
|
||||
# 4. Tester changements en backtest avant paper trading
|
||||
Reference in New Issue
Block a user