|
@@ -652,12 +652,11 @@ def _grid_fill_proximity(strategy: dict[str, Any], narrative_payload: dict[str,
|
|
|
|
|
|
|
|
|
|
|
|
|
def _grid_fill_fights_breakout(grid_fill: dict[str, Any], breakout: dict[str, Any]) -> bool:
|
|
def _grid_fill_fights_breakout(grid_fill: dict[str, Any], breakout: dict[str, Any]) -> bool:
|
|
|
- side = str(grid_fill.get("near_fill_side") or "")
|
|
|
|
|
- bias = str(breakout.get("meso_bias") or breakout.get("micro_bias") or "")
|
|
|
|
|
- if bias == "bullish":
|
|
|
|
|
- return side == "sell"
|
|
|
|
|
- if bias == "bearish":
|
|
|
|
|
- return side == "buy"
|
|
|
|
|
|
|
+ """Whether a nearby grid fill is trading against the breakout move.
|
|
|
|
|
+
|
|
|
|
|
+ Current product requirement: grid proximity-to-fills should not block or trigger a handoff.
|
|
|
|
|
+ We only care about overall regime/tradeoff (fees vs staying), not which side happens to fill.
|
|
|
|
|
+ """
|
|
|
return False
|
|
return False
|
|
|
|
|
|
|
|
|
|
|
|
@@ -744,8 +743,7 @@ def _grid_switch_tradeoff(*,
|
|
|
switch_benefit += 0.28
|
|
switch_benefit += 0.28
|
|
|
if trend_ready:
|
|
if trend_ready:
|
|
|
switch_benefit += 0.34
|
|
switch_benefit += 0.34
|
|
|
- if fill_fights:
|
|
|
|
|
- switch_benefit += 0.12
|
|
|
|
|
|
|
+ # Requirement: ignore nearby fill timing/side when estimating the stay-vs-switch tradeoff.
|
|
|
if levels >= _trend_handoff_level_threshold(breakout):
|
|
if levels >= _trend_handoff_level_threshold(breakout):
|
|
|
switch_benefit += 0.18
|
|
switch_benefit += 0.18
|
|
|
switch_benefit += min(trend_score, 2.5) * 0.18
|
|
switch_benefit += min(trend_score, 2.5) * 0.18
|
|
@@ -770,10 +768,7 @@ def _grid_switch_tradeoff(*,
|
|
|
stay_cost += 0.1
|
|
stay_cost += 0.1
|
|
|
stay_cost += min(levels, 6.0) * 0.06
|
|
stay_cost += min(levels, 6.0) * 0.06
|
|
|
stay_cost += min(open_order_count, 8) * 0.025
|
|
stay_cost += min(open_order_count, 8) * 0.025
|
|
|
- if near_fill:
|
|
|
|
|
- stay_cost += 0.06
|
|
|
|
|
- if fill_fights:
|
|
|
|
|
- stay_cost += 0.18
|
|
|
|
|
|
|
+ # Requirement: ignore nearby fill timing/side when estimating the stay-vs-switch tradeoff.
|
|
|
if not persistent:
|
|
if not persistent:
|
|
|
stay_cost += 0.12
|
|
stay_cost += 0.12
|
|
|
if adverse_notional_ratio >= 1.0:
|
|
if adverse_notional_ratio >= 1.0:
|