build(agent): new-agents-2#7e3bbc iteration
This commit is contained in:
parent
3ac4affb5e
commit
096e0c408e
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue