This commit is contained in:
aaron 2026-03-22 12:03:04 +08:00
parent 83c9033967
commit 04783937df
2 changed files with 7 additions and 7 deletions

View File

@ -212,8 +212,8 @@ class Settings(BaseSettings):
hyperliquid_trading_enabled: bool = False # Hyperliquid 实盘交易开关(默认关闭)
# Hyperliquid 环境变量(由 clawfi-hyperliquid-skill 安装脚本注入)
# CLAWFI_WALLET_ADDRESS - 主钱包地址
# CLAWFI_PRIVATE_KEY - Agent 专用私钥
clawfi_wallet_address: Optional[str] = None # 主钱包地址
clawfi_private_key: Optional[str] = None # Agent 专用私钥
# Hyperliquid 风险控制
hyperliquid_max_total_leverage: float = 10.0 # 总杠杆上限≤10xClawFi 强制规则)

View File

@ -28,14 +28,14 @@ class HyperliquidTradingService:
self.settings = get_settings()
# 从环境变量加载认证信息
self.wallet_address = os.getenv("CLAWFI_WALLET_ADDRESS")
self.private_key = os.getenv("CLAWFI_PRIVATE_KEY")
# 从 settings 加载认证信息
self.wallet_address = self.settings.clawfi_wallet_address
self.private_key = self.settings.clawfi_private_key
if not self.wallet_address or not self.private_key:
raise ValueError(
"缺少 Hyperliquid 认证信息。请运行: "
"npx clawfi-hyperliquid-skill --wallet=0x... --key=0x..."
"缺少 Hyperliquid 认证信息。请在 .env 中设置: "
"CLAWFI_WALLET_ADDRESS 和 CLAWFI_PRIVATE_KEY"
)
# 风控配置