3146a632d4
- Register EUR/USD in config (pip 0.0001, EurUsdStrategyConfig) - Create pair_signals/ module: registry + dispatcher with per-pair config factories (xauusd.py, eurusd.py) for easy add/remove - EUR/USD gets forex-tuned regime weights, London+NY session hours, XAU strategy gates disabled - Add defense-in-depth display_name guards in signal_aggregator - Rename telegram_bot.py → testing_telegram_bot.py with separate bot token, both pairs with dedicated button rows - Add EUR/USD to news engine affected pairs map - 9 new tests (146 total, all passing) - Zero changes to engine.py, data_provider.py, main.py, backtest/ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
53 lines
1.4 KiB
Python
53 lines
1.4 KiB
Python
"""
|
|
Per-pair signal producers.
|
|
|
|
Each pair module exposes:
|
|
make_config(primary_tf, confirmation_tfs) -> PlatformConfig
|
|
|
|
To add a new pair: create pair_signals/<pair>.py with make_config(),
|
|
then register it in this file.
|
|
"""
|
|
|
|
from typing import Optional, List, Dict, Callable
|
|
|
|
from config import PlatformConfig, Timeframe
|
|
from signal_aggregator import SignalAggregator, SignalReport
|
|
from data_provider import ForexDataProvider
|
|
|
|
PAIR_PRODUCERS: Dict[str, Callable] = {}
|
|
|
|
|
|
def register_pair(symbol: str, config_factory: Callable):
|
|
PAIR_PRODUCERS[symbol] = config_factory
|
|
|
|
|
|
def get_supported_pairs() -> List[str]:
|
|
return list(PAIR_PRODUCERS.keys())
|
|
|
|
|
|
def produce_signal(
|
|
symbol: str,
|
|
primary_tf: Timeframe,
|
|
data_provider: ForexDataProvider,
|
|
confirmation_tfs: Optional[List[Timeframe]] = None,
|
|
) -> SignalReport:
|
|
config_factory = PAIR_PRODUCERS.get(symbol)
|
|
if config_factory is None:
|
|
raise ValueError(
|
|
f"No signal producer registered for {symbol}. "
|
|
f"Available: {list(PAIR_PRODUCERS.keys())}"
|
|
)
|
|
|
|
config = config_factory(primary_tf, confirmation_tfs)
|
|
aggregator = SignalAggregator(config)
|
|
aggregator.data_provider = data_provider
|
|
return aggregator.analyze_pair(symbol=symbol)
|
|
|
|
|
|
from pair_signals import xauusd as _xau_mod
|
|
from pair_signals import eurusd as _eur_mod
|
|
from config import XAUUSD, EURUSD
|
|
|
|
register_pair(XAUUSD, _xau_mod.make_config)
|
|
register_pair(EURUSD, _eur_mod.make_config)
|