45bd90d1b3
- backtest/diagnose_filters: unused BacktestConfig import - pair_signals/__init__: unused PlatformConfig import - scripts/shadow_scan: unused pandas import - research burst_precursors / calendar_impact / duka_spread: unused sys / COST / struct - test_all: MagicMock, StringIO, Colors and two function-local imports that nothing in the test bodies used - telegram_bot: ViolentWatch is only a type hint -> imported under TYPE_CHECKING compare_oanda_tiingo.py and oanda_td_divergence.py are left alone here because the hygiene commit deletes them. Suite: 464 passed, 0 failed (unchanged). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0156YhogLytzj9P2iH1skGbL
52 lines
1.4 KiB
Python
52 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 Timeframe
|
|
from signal_aggregator import SignalAggregator, SignalReport
|
|
from providers import BaseDataProvider
|
|
|
|
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: BaseDataProvider,
|
|
confirmation_tfs: Optional[List[Timeframe]] = None,
|
|
log_source: str = "dashboard",
|
|
) -> 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, log_source=log_source)
|
|
|
|
|
|
from pair_signals import xauusd as _xau_mod
|
|
from config import XAUUSD
|
|
|
|
register_pair(XAUUSD, _xau_mod.make_config)
|