Tune CoinOX env: drop auto-transfer; map leverage to hedge perp opens.

BTC_LEVERAGE/ALT_LEVERAGE now drive永期永续 default leverage in UI and start fallback.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-14 12:46:14 +08:00
parent 4b1c629d26
commit 4c48c95562
7 changed files with 62 additions and 46 deletions
+8 -7
View File
@@ -845,18 +845,19 @@ def register_hedge_plan_routes(app: Flask, cfg: dict[str, Any]) -> None:
err = validate_start_body(plan_type, body)
if err:
return jsonify({"ok": False, "msg": err, "gates": gates}), 400
# 补齐永续杠杆(以期权为主默认 100;保险模式 BTC/ETH 用 btc_leverage)
# 补齐永续杠杆:页面未填时用 env(BTC_LEVERAGE / ALT_LEVERAGE=ETH)
if plan_type == "perp_options" and not body.get("leverage"):
from lib.hedge_plan.hedge_plan_option_primary_lib import is_option_primary
if is_option_primary(body):
base = str(body.get("underlying") or "ETH").upper()
if base == "BTC":
body["leverage"] = int(cfg.get("btc_leverage") or 10)
elif base == "ETH":
body["leverage"] = int(cfg.get("alt_leverage") or cfg.get("btc_leverage") or 10)
elif is_option_primary(body):
body["leverage"] = 100
else:
base = str(body.get("underlying") or "ETH").upper()
if base in ("BTC", "ETH"):
body["leverage"] = int(cfg.get("btc_leverage") or 10)
else:
body["leverage"] = int(cfg.get("alt_leverage") or 5)
body["leverage"] = int(cfg.get("alt_leverage") or 5)
# 以期权为主:策略启动=盯盘,不现场开仓
if plan_type == "perp_options":
from lib.hedge_plan.hedge_plan_option_primary_lib import is_option_primary