fix(options): expose chain DTE in env UI and show nearest expiries for OO

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-10 17:54:03 +08:00
parent a90876d772
commit 860ebef4a7
6 changed files with 45 additions and 16 deletions
+5 -3
View File
@@ -364,11 +364,13 @@ def register_options_routes(app: Flask, cfg: dict[str, Any]) -> None:
if ex is None:
return jsonify({"ok": False, "msg": err})
u = (request.args.get("underlying") or cfg["default_underly"]).upper()
# 热更新:链展示天数每次读 env,保存后刷新链即可
chain_max_dte = _env_float("OKX_OPTIONS_CHAIN_MAX_DTE_DAYS", float(cfg.get("chain_max_dte_days") or 14))
try:
chain = cfg["build_option_chain"](
ex,
u,
max_dte_days=cfg["chain_max_dte_days"],
max_dte_days=chain_max_dte,
itm_only=False,
itm_max_dist_usd=cfg["itm_max_dist"],
)
@@ -385,7 +387,7 @@ def register_options_routes(app: Flask, cfg: dict[str, Any]) -> None:
"ok": False,
"msg": chain_err or "暂无到期日,请稍后点「刷新链」",
**chain,
"chain_max_dte_days": cfg["chain_max_dte_days"],
"chain_max_dte_days": chain_max_dte,
"ask_liq_filter_enabled": ask_liq_filter,
"budget_buffer": budget_buffer,
"trade_budget": cfg["trade_budget"],
@@ -395,7 +397,7 @@ def register_options_routes(app: Flask, cfg: dict[str, Any]) -> None:
{
"ok": True,
**chain,
"chain_max_dte_days": cfg["chain_max_dte_days"],
"chain_max_dte_days": chain_max_dte,
"ask_liq_filter_enabled": ask_liq_filter,
"budget_buffer": budget_buffer,
"trade_budget": cfg["trade_budget"],