malkhut(wire): venue passed through matrix recording for cross-exchange comparison
- evaluator: passes scenario.venue to matrix.record(venue=...) - PerformanceMatrix.record(): accepts venue parameter (default='bingx') - Enables cross-exchange learnings: same strategy tested on BingX vs Binance gets separate performance entries per venue Adversary ecology analysis: Counterparties operate at ActionKind level (CROSS_SPREAD/PLACE/CANCEL), not at order-type level. The CWM infers order type from ActionKind: CROSS_SPREAD → fills aggressively → equivalent to MARKET PLACE → passive quote → equivalent to LIMIT This is correct and venue-independent. Fee calculation already uses VenueRules (per-exchange fees). No adversary changes needed.
This commit is contained in:
@@ -1046,6 +1046,7 @@ class PolicyEvaluator:
|
|||||||
# TIE-IN: Record strategy × regime performance
|
# TIE-IN: Record strategy × regime performance
|
||||||
if record_to_matrix and matrix is not None:
|
if record_to_matrix and matrix is not None:
|
||||||
tags = scenario.tags
|
tags = scenario.tags
|
||||||
|
venue_tag = scenario.venue
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
matrix.record(
|
matrix.record(
|
||||||
strategy_id=params.version,
|
strategy_id=params.version,
|
||||||
@@ -1054,6 +1055,7 @@ class PolicyEvaluator:
|
|||||||
pnl_bps=result.pnl_bps,
|
pnl_bps=result.pnl_bps,
|
||||||
drawdown_bps=result.max_drawdown_bps,
|
drawdown_bps=result.max_drawdown_bps,
|
||||||
adverse_fill_ratio=result.adverse_fill_count / max(result.order_count, 1),
|
adverse_fill_ratio=result.adverse_fill_count / max(result.order_count, 1),
|
||||||
|
venue=venue_tag,
|
||||||
)
|
)
|
||||||
score = self._robust_score(results, params)
|
score = self._robust_score(results, params)
|
||||||
return score, results
|
return score, results
|
||||||
|
|||||||
@@ -188,8 +188,9 @@ class PerformanceMatrix:
|
|||||||
pnl_bps: float = 0.0,
|
pnl_bps: float = 0.0,
|
||||||
drawdown_bps: float = 0.0,
|
drawdown_bps: float = 0.0,
|
||||||
adverse_fill_ratio: float = 0.0,
|
adverse_fill_ratio: float = 0.0,
|
||||||
|
venue: str = "bingx",
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Record a strategy's performance in a regime."""
|
"""Record a strategy's performance in a regime (optionally venue-tagged)."""
|
||||||
key = (regime, strategy_id)
|
key = (regime, strategy_id)
|
||||||
existing = self._scores.get(key)
|
existing = self._scores.get(key)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user