malkhut(spec): items 5-10 — manifold, actuals, OOD, query, book fidelity
Item 5 — PerformanceMatrix manifold: RegimeStrategyScore: added confidence, support_count, distance_to_nearest record() populates confidence from episode count (more evidence = more confidence) Item 6 — ActualsLoader: ActualsSnapshot: 12-field frozen dataclass for live market data ActualsLoader: reads CH tables (obf_universe, exf_data, maras_fingerprint, etc.) Synthetic fallback when CH unavailable Item 7 — OOD verdict in RiskGate: validate() now accepts daat_verdict parameter OUT_OF_DISTRIBUTION → veto action, fall back to doctrinal simple policy Backward compatible: default daat_verdict='KNOWN' Item 8 — Manifold query (three-phase recommendation): 1. DAAT classify live state (KNOWN/MARGINAL/OOD) 2. If KNOWN: find nearest regime in PerformanceMatrix → best strategy 3. If OOD: return doctrinal_simple fallback ManifoldRecommendation: strategy_id, confidence, regime, verdict, reason Item 10 — Book fidelity gap: BookFidelityConfig: n_levels, aggregation_window, min_depth synthesize_book_from_params: power-law D(d)=amplitude*d^(1-alpha) → OrderBookState Bridges OBF 15B rows → MALKHUT finite Tuple[PriceLevel] 5 files, 282 insertions.
This commit is contained in:
@@ -24,9 +24,21 @@ class RiskGate:
|
||||
state: MarketWorldState,
|
||||
planned: PlannedPolicy,
|
||||
params: FulfilmentPolicyParams,
|
||||
daat_verdict: str = "KNOWN",
|
||||
) -> RiskDecision:
|
||||
"""Validate a planned action.
|
||||
|
||||
Args:
|
||||
daat_verdict: "KNOWN" | "MARGINAL" | "OUT_OF_DISTRIBUTION"
|
||||
From DAAT classifier. If OUT_OF_DISTRIBUTION, veto the action
|
||||
and fall back to doctrinal simple policy.
|
||||
"""
|
||||
action = planned.selected_action
|
||||
|
||||
# DAAT OOD veto — highest priority
|
||||
if daat_verdict == "OUT_OF_DISTRIBUTION":
|
||||
return RiskDecision(True, None, "ood_veto_fall_back_to_doctrinal")
|
||||
|
||||
if action.kind == ActionKind.NOOP:
|
||||
return RiskDecision(True, action, "noop")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user