Sync scripts with latest changes from florida directory
This commit is contained in:
@ -24,6 +24,7 @@ DEFAULT_STRATEGY = {
|
||||
"TRANSACTION_TIMEOUT_SECONDS": 30, # Timeout for blockchain transactions
|
||||
|
||||
# Hedging Settings
|
||||
"HEDGE_STRATEGY": "ASYMMETRIC", # Options: "STANDARD" (Full Range Hedge), "ASYMMETRIC" (Edge-Only Reduction)
|
||||
"MIN_HEDGE_THRESHOLD": Decimal("0.012"), # Minimum delta change (in coins) required to trigger a trade
|
||||
|
||||
# Unified Hedger Settings
|
||||
|
||||
@ -213,7 +213,7 @@ class HyperliquidStrategy:
|
||||
else: # >=5% range
|
||||
return Decimal("0.075") # Standard for wide ranges
|
||||
|
||||
def calculate_rebalance(self, current_price: Decimal, current_short_size: Decimal) -> Dict:
|
||||
def calculate_rebalance(self, current_price: Decimal, current_short_size: Decimal, strategy_type: str = "ASYMMETRIC") -> Dict:
|
||||
# Note: current_short_size here is virtual (just for this specific strategy),
|
||||
# but the unified hedger will use the 'target_short' output primarily.
|
||||
|
||||
@ -221,6 +221,8 @@ class HyperliquidStrategy:
|
||||
|
||||
# --- ASYMMETRIC COMPENSATION ---
|
||||
adj_pct = Decimal("0.0")
|
||||
|
||||
if strategy_type == "ASYMMETRIC":
|
||||
range_width = self.high_range - self.low_range
|
||||
|
||||
if range_width > 0:
|
||||
@ -664,8 +666,12 @@ class UnifiedHedger:
|
||||
if coin not in self.last_prices: continue
|
||||
price = self.last_prices[coin]
|
||||
|
||||
# Get Config & Strategy Type
|
||||
config = self.coin_configs.get(coin, {})
|
||||
strategy_type = config.get("HEDGE_STRATEGY", "ASYMMETRIC")
|
||||
|
||||
# Calc Logic
|
||||
calc = strat.calculate_rebalance(price, Decimal("0"))
|
||||
calc = strat.calculate_rebalance(price, Decimal("0"), strategy_type)
|
||||
|
||||
if coin not in aggregates:
|
||||
aggregates[coin] = {'target_short': Decimal("0"), 'contributors': 0, 'is_at_edge': False, 'is_at_bottom_edge': False, 'adj_pct': Decimal("0"), 'is_closing': False}
|
||||
@ -788,7 +794,9 @@ class UnifiedHedger:
|
||||
# --- ASYMMETRIC HEDGE CHECK ---
|
||||
is_asymmetric_blocked = False
|
||||
p_mid_asym = Decimal("0")
|
||||
if is_buy_bool and not bypass_cooldown:
|
||||
strategy_type = config.get("HEDGE_STRATEGY", "ASYMMETRIC")
|
||||
|
||||
if strategy_type == "ASYMMETRIC" and is_buy_bool and not bypass_cooldown:
|
||||
total_L_asym = Decimal("0")
|
||||
for k_strat, strat_inst in self.strategies.items():
|
||||
if self.strategy_states[k_strat]['coin'] == coin:
|
||||
|
||||
Reference in New Issue
Block a user