Fix config mismatch: prioritize TARGET_DEX settings and set BOTTOM strategy for UNISWAP_V3
This commit is contained in:
@ -73,6 +73,8 @@ CLP_PROFILES = {
|
||||
"TOKEN_B_ADDRESS": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", # USDC
|
||||
"WRAPPED_NATIVE_ADDRESS": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
|
||||
"POOL_FEE": 500,
|
||||
"TARGET_INVESTMENT_AMOUNT": 1000,
|
||||
"HEDGE_STRATEGY": "BOTTOM",
|
||||
},
|
||||
"UNISWAP_wide": {
|
||||
"NAME": "Uniswap V3 (Arbitrum) - ETH/USDC Wide",
|
||||
|
||||
@ -27,7 +27,7 @@ from eth_account import Account
|
||||
from hyperliquid.exchange import Exchange
|
||||
from hyperliquid.info import Info
|
||||
from hyperliquid.utils import constants
|
||||
from clp_config import CLP_PROFILES, DEFAULT_STRATEGY
|
||||
from clp_config import CLP_PROFILES, DEFAULT_STRATEGY, TARGET_DEX
|
||||
|
||||
# Load environment variables
|
||||
dotenv_path = os.path.join(current_dir, '.env')
|
||||
@ -301,6 +301,7 @@ class UnifiedHedger:
|
||||
|
||||
def _init_coin_configs(self):
|
||||
"""Pre-load configuration for known coins from CLP_PROFILES."""
|
||||
# 1. Load all profiles (order depends on dict iteration)
|
||||
for profile_key, profile_data in CLP_PROFILES.items():
|
||||
symbol = profile_data.get("COIN_SYMBOL")
|
||||
if symbol:
|
||||
@ -312,6 +313,18 @@ class UnifiedHedger:
|
||||
# Update with Profile Specifics
|
||||
self.coin_configs[symbol].update(profile_data)
|
||||
|
||||
# 2. Force overwrite with TARGET_DEX profile to ensure precedence
|
||||
target_profile = CLP_PROFILES.get(TARGET_DEX)
|
||||
if target_profile:
|
||||
symbol = target_profile.get("COIN_SYMBOL")
|
||||
if symbol:
|
||||
if symbol not in self.coin_configs:
|
||||
self.coin_configs[symbol] = DEFAULT_STRATEGY.copy()
|
||||
self.coin_configs[symbol]["sz_decimals"] = 4
|
||||
|
||||
logger.info(f"Overwriting config for {symbol} using TARGET_DEX: {TARGET_DEX}")
|
||||
self.coin_configs[symbol].update(target_profile)
|
||||
|
||||
def _get_sz_decimals(self, coin: str) -> int:
|
||||
try:
|
||||
meta = self.info.meta()
|
||||
|
||||
Reference in New Issue
Block a user