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>
31 lines
942 B
Python
31 lines
942 B
Python
from __future__ import annotations
|
|
|
|
from collections.abc import Callable
|
|
from typing import Any
|
|
|
|
|
|
_TERMINAL_TRADE_HANDLERS: dict[str, Callable[[dict[str, Any]], Any]] = {}
|
|
|
|
|
|
def register_terminal_trade_handler(account_id: str, handler: Callable[[dict[str, Any]], Any]) -> None:
|
|
key = str(account_id or "").strip()
|
|
if not key:
|
|
return
|
|
_TERMINAL_TRADE_HANDLERS[key] = handler
|
|
|
|
|
|
def unregister_terminal_trade_handler(account_id: str, handler: Callable[[dict[str, Any]], Any] | None = None) -> None:
|
|
key = str(account_id or "").strip()
|
|
if not key:
|
|
return
|
|
current = _TERMINAL_TRADE_HANDLERS.get(key)
|
|
if handler is None or current is handler:
|
|
_TERMINAL_TRADE_HANDLERS.pop(key, None)
|
|
|
|
|
|
def get_terminal_trade_handler(account_id: str) -> Callable[[dict[str, Any]], Any] | None:
|
|
key = str(account_id or "").strip()
|
|
if not key:
|
|
return None
|
|
return _TERMINAL_TRADE_HANDLERS.get(key)
|