Hierarchical ML Pipeline for trading predictions:
- Level 0: Attention Models (volatility/flow classification)
- Level 1: Base Models (XGBoost per symbol/timeframe)
- Level 2: Metamodels (XGBoost Stacking + Neural Gating)
Key components:
- src/pipelines/hierarchical_pipeline.py - Main prediction pipeline
- src/models/ - All ML model classes
- src/training/ - Training utilities
- src/api/ - FastAPI endpoints
- scripts/ - Training and evaluation scripts
- config/ - YAML configurations
Note: Trained models (*.joblib, *.pt) are gitignored.
Regenerate with training scripts.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
172 lines
5.5 KiB
YAML
172 lines
5.5 KiB
YAML
# ============================================================================
|
|
# VALIDATION OUT-OF-SAMPLE CONFIGURATION
|
|
# ============================================================================
|
|
# Archivo: config/validation_oos.yaml
|
|
# Proposito: Configurar validacion out-of-sample excluyendo 2025 del training
|
|
# Fecha: 2026-01-04
|
|
# Creado por: ML-Specialist (NEXUS v4.0)
|
|
# ============================================================================
|
|
|
|
validation:
|
|
# -------------------------------------------------------------------------
|
|
# PERIODO DE TRAINING
|
|
# -------------------------------------------------------------------------
|
|
# Datos usados para entrenar los modelos
|
|
# IMPORTANTE: 2025 esta EXCLUIDO para validacion out-of-sample
|
|
train:
|
|
start_date: "2023-01-01T00:00:00"
|
|
end_date: "2024-12-31T23:59:59"
|
|
description: "Datos historicos para entrenamiento de modelos"
|
|
|
|
# -------------------------------------------------------------------------
|
|
# PERIODO DE VALIDACION OUT-OF-SAMPLE
|
|
# -------------------------------------------------------------------------
|
|
# Datos NUNCA vistos durante el entrenamiento
|
|
# Usados para evaluar performance real del modelo
|
|
test_oos:
|
|
start_date: "2025-01-01T00:00:00"
|
|
end_date: "2025-12-31T23:59:59"
|
|
description: "Datos del 2025 excluidos del training para validacion"
|
|
|
|
# -------------------------------------------------------------------------
|
|
# METODO DE EXCLUSION
|
|
# -------------------------------------------------------------------------
|
|
exclusion_method: "temporal" # Options: temporal, walk_forward
|
|
|
|
# -------------------------------------------------------------------------
|
|
# WALK-FORWARD CONFIGURATION (si exclusion_method = walk_forward)
|
|
# -------------------------------------------------------------------------
|
|
walk_forward:
|
|
enabled: false
|
|
n_splits: 5
|
|
expanding_window: false
|
|
test_size: 0.2
|
|
gap: 0 # Barras de gap entre train y test (evitar look-ahead)
|
|
min_train_size: 10000
|
|
|
|
# ============================================================================
|
|
# METRICAS OBJETIVO (TRADING-STRATEGIST)
|
|
# ============================================================================
|
|
# Umbrales minimos para aprobar el modelo
|
|
# Referencia: PERFIL-TRADING-STRATEGIST.md
|
|
|
|
metrics_thresholds:
|
|
# =========================================================================
|
|
# OBJETIVOS ML-FIRST (Actualizado 2026-01-04)
|
|
# Target: 80% win rate, 30-100% rendimiento semanal
|
|
# =========================================================================
|
|
|
|
# Ratios Risk-Adjusted
|
|
sharpe_ratio_min: 1.5
|
|
sharpe_ratio_target: 2.5
|
|
sortino_ratio_min: 2.0
|
|
calmar_ratio_min: 1.5
|
|
|
|
# Riesgo
|
|
max_drawdown_max: 0.15 # 15% maximo drawdown (mas conservador)
|
|
|
|
# Performance - OBJETIVO PRINCIPAL
|
|
win_rate_min: 0.75 # 75% minimo (target 80%)
|
|
win_rate_target: 0.80 # 80% objetivo
|
|
profit_factor_min: 2.0 # Profit factor minimo 2.0
|
|
profit_factor_target: 4.0 # Con 80% WR y RR 1:1 = PF 4.0
|
|
|
|
# Rendimiento semanal
|
|
weekly_return_min: 0.10 # 10% semanal minimo
|
|
weekly_return_target: 0.30 # 30% semanal objetivo
|
|
|
|
# Overfitting detection
|
|
in_sample_vs_oos_threshold: 0.40 # Si OOS < 60% de in-sample, posible overfitting
|
|
|
|
# ============================================================================
|
|
# CONFIGURACION DE BACKTEST
|
|
# ============================================================================
|
|
|
|
backtest:
|
|
initial_capital: 10000.0
|
|
risk_per_trade: 0.02 # 2% por trade
|
|
max_concurrent_trades: 1
|
|
commission_pct: 0.001 # 0.1%
|
|
slippage_pct: 0.0005 # 0.05%
|
|
|
|
# Configuraciones R:R a probar
|
|
rr_configs:
|
|
# Configuraciones agresivas (mayor profit potencial, menor win rate)
|
|
- name: "rr_2_1"
|
|
sl_pips: 5.0
|
|
tp_pips: 10.0
|
|
target_win_rate: 0.50
|
|
|
|
- name: "rr_3_1"
|
|
sl_pips: 5.0
|
|
tp_pips: 15.0
|
|
target_win_rate: 0.40
|
|
|
|
# Configuraciones conservadoras para 80% WR (mayor SL, menor TP)
|
|
- name: "rr_1_2_80wr"
|
|
sl_pips: 10.0
|
|
tp_pips: 5.0
|
|
target_win_rate: 0.80
|
|
description: "Conservador 80% WR - TP pequeño, SL amplio"
|
|
|
|
- name: "rr_1_3_80wr"
|
|
sl_pips: 15.0
|
|
tp_pips: 5.0
|
|
target_win_rate: 0.85
|
|
description: "Muy conservador 85% WR"
|
|
|
|
# Range-based (usa predicciones de RangePredictorV2)
|
|
- name: "range_adaptive"
|
|
use_range_predictions: true
|
|
tp_range_pct: 0.5 # TP al 50% del rango predicho
|
|
sl_range_pct: 1.5 # SL al 150% del rango opuesto
|
|
target_win_rate: 0.80
|
|
|
|
# Filtros de entrada
|
|
min_confidence: 0.55
|
|
filter_by_amd: true
|
|
favorable_amd_phases:
|
|
- "accumulation"
|
|
- "distribution"
|
|
filter_by_volatility: true
|
|
min_volatility_regime: "medium"
|
|
|
|
# Timeout
|
|
max_position_time_minutes: 60
|
|
|
|
# ============================================================================
|
|
# SIMBOLOS A EVALUAR
|
|
# ============================================================================
|
|
|
|
symbols:
|
|
- symbol: "XAUUSD"
|
|
description: "Gold vs USD"
|
|
enabled: true
|
|
|
|
- symbol: "EURUSD"
|
|
description: "Euro vs USD"
|
|
enabled: false
|
|
|
|
- symbol: "GBPUSD"
|
|
description: "GBP vs USD"
|
|
enabled: false
|
|
|
|
# ============================================================================
|
|
# REPORTES
|
|
# ============================================================================
|
|
|
|
reports:
|
|
output_dir: "reports/validation"
|
|
formats:
|
|
- json
|
|
- csv
|
|
include_equity_curve: true
|
|
include_trade_log: true
|
|
include_metrics_by_segment: true
|
|
segments:
|
|
- by_horizon
|
|
- by_rr_config
|
|
- by_amd_phase
|
|
- by_volatility
|
|
- by_direction
|