VIOLET V3.4b: launcher shadow live-factor wiring
This commit is contained in:
@@ -50,6 +50,10 @@ from prod.launch_dolphin_pink import ( # noqa: E402
|
||||
_resolve_bingx_exchange_leverage_cap,
|
||||
_resolve_bingx_recv_window_ms,
|
||||
)
|
||||
from prod.clean_arch.violet.shadow_live_factors import ( # noqa: E402
|
||||
build_shadow_live_source,
|
||||
shadow_decision_step,
|
||||
)
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
@@ -260,17 +264,18 @@ async def _divergence_driver(divergence, data_feed, poll_s: float, shadow=None)
|
||||
if shadow is not None and started:
|
||||
try:
|
||||
sn = int(payload.get("scan_number") or 0)
|
||||
shadow["engine"].observe(payload, sn)
|
||||
vd = payload.get("vel_div")
|
||||
if vd is not None:
|
||||
now_ns = shadow["mono_ns"]()
|
||||
d = shadow["engine"].decide(
|
||||
now_ns=now_ns, scan_number=sn,
|
||||
capital=shadow["capital"], vel_div=float(vd),
|
||||
if shadow_decision_step(
|
||||
shadow,
|
||||
payload,
|
||||
scan_number=sn,
|
||||
now_ns=now_ns,
|
||||
vel_div=float(vd),
|
||||
vol_ok=bool(payload.get("vol_ok", True)),
|
||||
)
|
||||
if d is not None:
|
||||
shadow["journal"].journal(d, mono_ns=now_ns)
|
||||
):
|
||||
shadow["live_decisions"] += 1
|
||||
except Exception as exc: # noqa: BLE001 — shadow must never die
|
||||
LOGGER.debug("shadow decision failed: %s", exc)
|
||||
except Exception as exc: # noqa: BLE001 — sampling must never die
|
||||
@@ -333,13 +338,29 @@ def _build_shadow():
|
||||
relaxed = abs(thr - (-0.02)) > 1e-9
|
||||
engine = VioletDecisionEngine(entry_vel_div_threshold=thr)
|
||||
journal = VioletDecisionJournal(sink=ch_put_violet, session_id=sess)
|
||||
try:
|
||||
live_source = build_shadow_live_source()
|
||||
except Exception as exc:
|
||||
LOGGER.warning(
|
||||
"VIOLET shadow live-factor source unavailable (%s) — shadow DISABLED.",
|
||||
exc,
|
||||
)
|
||||
return None
|
||||
LOGGER.warning(
|
||||
"VIOLET DECISION SHADOW ON (session=%s ref_capital=%.0f entry_thr=%.4f%s) — "
|
||||
"journaling muted decisions to dolphin_violet.violet_decisions; NO orders.",
|
||||
sess, capital, thr,
|
||||
" RELAXED:not-parity-faithful" if relaxed else "",
|
||||
)
|
||||
return {"engine": engine, "journal": journal, "capital": capital, "mono_ns": mono_ns}
|
||||
return {
|
||||
"engine": engine,
|
||||
"journal": journal,
|
||||
"capital": capital,
|
||||
"mono_ns": mono_ns,
|
||||
**live_source,
|
||||
"live_decisions": 0,
|
||||
"last_live_source": None,
|
||||
}
|
||||
|
||||
|
||||
async def run() -> None:
|
||||
|
||||
Reference in New Issue
Block a user