From 096e0c408eeba3ad47ca1dadbe5a8da046970ae2 Mon Sep 17 00:00:00 2001 From: agent-7e3bbc424e07835b Date: Tue, 21 Apr 2026 11:13:51 +0200 Subject: [PATCH] build(agent): new-agents-2#7e3bbc iteration --- deltax_forge_cross/core/local_venue_solver.py | 20 ++++++++++++++++++- deltax_forge_cross/dsl.py | 3 +++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/deltax_forge_cross/core/local_venue_solver.py b/deltax_forge_cross/core/local_venue_solver.py index 610cf97..505531e 100644 --- a/deltax_forge_cross/core/local_venue_solver.py +++ b/deltax_forge_cross/core/local_venue_solver.py @@ -16,4 +16,22 @@ class LocalVenueSolver: if not asset_symbols: return {} per = strategy_delta.delta_budget / len(asset_symbols) - return {sym: per for sym in asset_symbols} + + # If a cross-venue constraint is provided for this venue, apply a conservative + # scaling factor to reflect latency/budget restrictions without breaking + # existing behavior when no constraints are supplied. + scale = 1.0 + try: + # strategy_delta.cross_venue_constraints is optional; default is empty dict + if hasattr(strategy_delta, "cross_venue_constraints"): + # If there's an explicit constraint for this venue, use it as a multiplier + venue_factor = strategy_delta.cross_venue_constraints.get(self.venue_id, 1.0) + # Clamp to [0, 1] to avoid over-allocation in constrained environments + if isinstance(venue_factor, (int, float)): + scale = max(0.0, min(1.0, float(venue_factor))) + except Exception: + # In case of unexpected types, fall back to default scale + scale = 1.0 + + adjusted = {sym: per * scale for sym in asset_symbols} + return adjusted diff --git a/deltax_forge_cross/dsl.py b/deltax_forge_cross/dsl.py index 1cb3c34..b4fe80d 100644 --- a/deltax_forge_cross/dsl.py +++ b/deltax_forge_cross/dsl.py @@ -58,3 +58,6 @@ class StrategyDelta: assets: List[Asset] = field(default_factory=list) legs: List[Leg] = field(default_factory=list) signals: List[MarketSignal] = field(default_factory=list) + # Cross-venue constraint budget map (venue_id -> allowed lag/latency budget or cap) + # This is optional and defaults to an empty dict for backwards compatibility. + cross_venue_constraints: Dict[str, float] = field(default_factory=dict)