#!/usr/bin/env python3
"""
MTS Strategy - Multi-Timeframe Synthesis
=========================================
Strategy 5 of the ml-engine trading system.

MTS combines signals from multiple timeframes (5m, 15m, 1h, 4h) using
a hierarchical attention mechanism to produce unified trading signals.

Key Components:
1. MTSFeatureEngineer: Aggregates and computes features across timeframes
2. HierarchicalAttention: Learns relationships between timeframes
3. MTSModel: Complete model with XGBoost for final prediction
4. MTSTrainer: Training with walk-forward validation

Outputs:
- Unified direction: -1 (bearish) to 1 (bullish)
- Confidence by alignment: 0 to 1 based on TF agreement
- Optimal entry timeframe: Best TF for trade execution

Example Usage:
    >>> from src.models.strategies.mts import MTSModel, MTSConfig
    >>>
    >>> # Create model
    >>> config = MTSConfig(d_model=128, n_heads=4)
    >>> model = MTSModel(config)
    >>>
    >>> # Train
    >>> trainer = MTSTrainer(model)
    >>> trainer.train('EURUSD', data=df_5m)
    >>>
    >>> # Predict
    >>> prediction = model.predict(df_5m)
    >>> print(f"Direction: {prediction.direction_class}")
    >>> print(f"Confidence: {prediction.confidence:.2f}")
    >>> print(f"Recommended: {prediction.recommended_action}")

Author: ML-Specialist (NEXUS v4.0)
Version: 1.0.0
Created: 2026-01-25
"""

# Feature Engineering
from .feature_engineering import (
    MTSFeatureEngineer,
    TimeframeDefinition,
)

# Hierarchical Attention
from .hierarchical_attention import (
    HierarchicalAttention,
    HierarchicalAttentionWithAlignment,
    HierarchicalAttentionConfig,
    TimeframeEncoder,
    CrossTimeframeAttention,
    MultiHeadAttentionTF,
    ScaledDotProductAttention,
)

# Model
from .model import (
    MTSModel,
    MTSConfig,
    MTSPrediction,
    MTSHead,
)

# Trainer
from .trainer import (
    MTSTrainer,
    MTSTrainerConfig,
    MTSTrainingMetrics,
    MTSDataset,
    HierarchicalLoss,
)


__all__ = [
    # Feature Engineering
    'MTSFeatureEngineer',
    'TimeframeDefinition',

    # Hierarchical Attention
    'HierarchicalAttention',
    'HierarchicalAttentionWithAlignment',
    'HierarchicalAttentionConfig',
    'TimeframeEncoder',
    'CrossTimeframeAttention',
    'MultiHeadAttentionTF',
    'ScaledDotProductAttention',

    # Model
    'MTSModel',
    'MTSConfig',
    'MTSPrediction',
    'MTSHead',

    # Trainer
    'MTSTrainer',
    'MTSTrainerConfig',
    'MTSTrainingMetrics',
    'MTSDataset',
    'HierarchicalLoss',
]


# Module version
__version__ = '1.0.0'
