""" Strategy Data Types and Signal Definitions This module provides data types for strategy calculations, signals, and results in a standardized format. """ from dataclasses import dataclass from datetime import datetime from typing import Dict, Optional, Any, List from enum import Enum class SignalType(str, Enum): """ Types of trading signals that strategies can generate. """ BUY = "buy" SELL = "sell" HOLD = "hold" ENTRY_LONG = "entry_long" EXIT_LONG = "exit_long" ENTRY_SHORT = "entry_short" EXIT_SHORT = "exit_short" STOP_LOSS = "stop_loss" TAKE_PROFIT = "take_profit" @dataclass class StrategySignal: """ Container for individual strategy signals. Attributes: timestamp: Signal timestamp (right-aligned with candle) symbol: Trading symbol timeframe: Candle timeframe signal_type: Type of signal (buy/sell/hold etc.) price: Price at which signal was generated confidence: Signal confidence score (0.0 to 1.0) metadata: Additional signal metadata (e.g., indicator values) """ timestamp: datetime symbol: str timeframe: str signal_type: SignalType price: float confidence: float = 1.0 metadata: Optional[Dict[str, Any]] = None @dataclass class StrategyResult: """ Container for strategy calculation results. Attributes: timestamp: Candle timestamp (right-aligned) symbol: Trading symbol timeframe: Candle timeframe strategy_name: Name of the strategy that generated this result signals: List of signals generated for this timestamp indicators_used: Dictionary of indicator values used in calculation metadata: Additional calculation metadata """ timestamp: datetime symbol: str timeframe: str strategy_name: str signals: List[StrategySignal] indicators_used: Dict[str, float] metadata: Optional[Dict[str, Any]] = None