repo hygiene: track the PINK launcher import closure
67 production .py modules that the running PINK service imports but which were never committed: prod/bingx/ (HTTP client, market/user streams, journal, config), prod/clean_arch/ adapters/persistence/runtime/dita/dita_v2 production modules and their co-located tests. Rule going forward: every module imported by launch_dolphin_pink.py / pink_direct.py must appear in git ls-files. Excludes _backup dirs, __pycache__, and non-code files. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
35
prod/clean_arch/policy/__init__.py
Normal file
35
prod/clean_arch/policy/__init__.py
Normal file
@@ -0,0 +1,35 @@
|
||||
"""Legacy policy namespace.
|
||||
|
||||
The canonical DITA boundary now lives in `prod.clean_arch.dita`.
|
||||
This package remains as a compatibility layer.
|
||||
"""
|
||||
|
||||
from .contracts import (
|
||||
AccountEvent,
|
||||
PolicyAction,
|
||||
PolicyConfig,
|
||||
PolicyContext,
|
||||
PolicyIntent,
|
||||
PolicyIntentContext,
|
||||
PolicyPosition,
|
||||
PolicySide,
|
||||
PolicyStage,
|
||||
PolicyTradeEvent,
|
||||
Decision,
|
||||
)
|
||||
from .engine import PolicyEngine
|
||||
|
||||
__all__ = [
|
||||
"AccountEvent",
|
||||
"Decision",
|
||||
"PolicyAction",
|
||||
"PolicyConfig",
|
||||
"PolicyContext",
|
||||
"PolicyEngine",
|
||||
"PolicyIntent",
|
||||
"PolicyIntentContext",
|
||||
"PolicyPosition",
|
||||
"PolicySide",
|
||||
"PolicyStage",
|
||||
"PolicyTradeEvent",
|
||||
]
|
||||
35
prod/clean_arch/policy/contracts.py
Normal file
35
prod/clean_arch/policy/contracts.py
Normal file
@@ -0,0 +1,35 @@
|
||||
"""Compatibility wrapper for the legacy policy namespace.
|
||||
|
||||
The canonical contracts now live under `prod.clean_arch.dita`.
|
||||
This module preserves the older import path for existing tests and callers.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from prod.clean_arch.dita.contracts import (
|
||||
AccountEvent,
|
||||
Decision,
|
||||
DecisionAction as PolicyAction,
|
||||
DecisionConfig as PolicyConfig,
|
||||
DecisionContext as PolicyContext,
|
||||
Intent as PolicyIntent,
|
||||
IntentContext as PolicyIntentContext,
|
||||
TradeEvent as PolicyTradeEvent,
|
||||
TradePosition as PolicyPosition,
|
||||
TradeSide as PolicySide,
|
||||
TradeStage as PolicyStage,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"AccountEvent",
|
||||
"PolicyAction",
|
||||
"PolicyConfig",
|
||||
"PolicyContext",
|
||||
"PolicyIntent",
|
||||
"PolicyIntentContext",
|
||||
"PolicyPosition",
|
||||
"PolicySide",
|
||||
"PolicyStage",
|
||||
"PolicyTradeEvent",
|
||||
"Decision",
|
||||
]
|
||||
44
prod/clean_arch/policy/engine.py
Normal file
44
prod/clean_arch/policy/engine.py
Normal file
@@ -0,0 +1,44 @@
|
||||
"""Compatibility wrapper for the legacy policy engine namespace."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
|
||||
from prod.clean_arch.dita.account import AccountProjection, AccountSnapshot
|
||||
from prod.clean_arch.dita.contracts import DecisionConfig as PolicyConfig
|
||||
from prod.clean_arch.dita.decision import DecisionEngine
|
||||
from prod.clean_arch.dita.intent import IntentEngine
|
||||
from prod.clean_arch.dita.trade import TradeExecutor
|
||||
|
||||
from .contracts import PolicyContext, PolicyPosition
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class PolicyContextWrapper:
|
||||
"""Backward-compatible context alias for older callers."""
|
||||
|
||||
capital: float
|
||||
open_positions: int = 0
|
||||
trade_seq: int = 0
|
||||
|
||||
|
||||
class PolicyEngine:
|
||||
"""Legacy facade that now delegates to the DITA boundary."""
|
||||
|
||||
def __init__(self, config: Optional[PolicyConfig] = None):
|
||||
self.config = config or PolicyConfig()
|
||||
self.decision_engine = DecisionEngine(self.config)
|
||||
self.intent_engine = IntentEngine(self.config)
|
||||
self.trade_executor = TradeExecutor()
|
||||
self.account = AccountProjection(
|
||||
runtime_namespace="pink",
|
||||
strategy_namespace="pink",
|
||||
event_namespace="pink",
|
||||
)
|
||||
self.account.snapshot = AccountSnapshot(capital=25_000.0, equity=25_000.0)
|
||||
|
||||
def decide(self, snapshot, context: PolicyContext, position: Optional[PolicyPosition] = None):
|
||||
decision = self.decision_engine.decide(snapshot, context, position)
|
||||
return decision
|
||||
|
||||
Reference in New Issue
Block a user