移植 A_Share_DP 引擎;本地缓存与 60s tip;月线由日线 UTC 聚合;不碰主站 analyze/缠论叠层。 Co-authored-by: Cursor <cursoragent@cursor.com>
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
"""Signal Engine — timeframe-local status labels only (not tradability)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from crypto_wyckoff.domain_models import EngineResult, WyckoffEvent
|
|
|
|
|
|
class SignalEngine:
|
|
"""Maps local Event/Phase into a status label. Decision decides tradability."""
|
|
|
|
name = "Signal"
|
|
version = "1.0.0"
|
|
|
|
def run(self, event: EngineResult, phase: EngineResult | None = None) -> EngineResult:
|
|
current = event.payload.get("current_event", WyckoffEvent.NONE.value)
|
|
conf = event.confidence
|
|
label = current # status label mirrors event for V1
|
|
reasons = [f"本地事件标签: {label}"]
|
|
if phase and phase.payload.get("phase"):
|
|
reasons.append(f"本地阶段: {phase.payload.get('phase')}")
|
|
|
|
return EngineResult(
|
|
name=self.name,
|
|
version=self.version,
|
|
confidence=conf,
|
|
score=event.score,
|
|
reasons=reasons,
|
|
payload={
|
|
"signal_label": label,
|
|
"current_event": current,
|
|
"phase": (phase.payload.get("phase") if phase else None),
|
|
"active_events": event.payload.get("active_events")
|
|
or event.payload.get("recent_events", []),
|
|
},
|
|
)
|