diff --git a/clp_hedger.py b/clp_hedger.py index 10892ed..194cf93 100644 --- a/clp_hedger.py +++ b/clp_hedger.py @@ -234,6 +234,18 @@ class HyperliquidStrategy: adj_pct = max(-max_boost, min(max_boost, adj_pct)) raw_target_short = pool_delta + + # --- BOTTOM STRATEGY LOGIC --- + if strategy_type == "BOTTOM": + if current_price > self.entry_price: + # Disable hedging in upper half + raw_target_short = Decimal("0") + adj_pct = Decimal("0") + else: + # Enable hedging in lower half (standard delta) + # No asymmetric boost applied + adj_pct = Decimal("0") + adjusted_target_short = raw_target_short * (Decimal("1.0") + adj_pct) diff = adjusted_target_short - abs(current_short_size) @@ -791,10 +803,18 @@ class UnifiedHedger: if not (is_buy_bool and data.get('is_at_bottom_edge', False)): bypass_cooldown = True + # --- BOTTOM STRATEGY SAFEGUARDS --- + strategy_type = config.get("HEDGE_STRATEGY", "ASYMMETRIC") + if strategy_type == "BOTTOM": + # strict: "do not use taker orders... except only on very bottom" + if not data.get('is_at_bottom_edge', False): + bypass_cooldown = False + force_taker_retry = False # Disable taker retry from fishing + # --- ASYMMETRIC HEDGE CHECK --- is_asymmetric_blocked = False p_mid_asym = Decimal("0") - strategy_type = config.get("HEDGE_STRATEGY", "ASYMMETRIC") + # strategy_type already fetched above if strategy_type == "ASYMMETRIC" and is_buy_bool and not bypass_cooldown: total_L_asym = Decimal("0")