From 6ac0f4478f6eb1bc14d2c8185fe9f8032f822a15 Mon Sep 17 00:00:00 2001 From: DiTus Date: Thu, 1 Jan 2026 21:01:58 +0100 Subject: [PATCH] Implement BOTTOM hedge strategy --- clp_hedger.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) 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")