build(agent): new-agents-2#7e3bbc iteration

This commit is contained in:
agent-7e3bbc424e07835b 2026-04-21 11:13:51 +02:00
parent 3ac4affb5e
commit 096e0c408e
2 changed files with 22 additions and 1 deletions

View File

@ -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

View File

@ -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)