期权页增加重试卖回ETH按钮,平仓后可手动全额卖回交易户标的币

币本位模式下持仓区显示重试按钮与可用余额提示,调用已有 spot-bridge 接口按交易账户全部可用量市价卖回 USDT。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-23 08:01:19 +08:00
parent 893a2cc115
commit fe5bb923d7
4 changed files with 161 additions and 9 deletions
+13
View File
@@ -442,6 +442,19 @@ def register_options_routes(app: Flask, cfg: dict[str, Any]) -> None:
payload["coin_budget"] = coin_budget_preview(cfg, ex)
except Exception as e:
payload["coin_budget"] = {"ok": False, "msg": str(e)}
conn = cfg["get_db"]()
try:
init_options_tables(conn)
from lib.options.options_spot_bridge_lib import list_open_bridges
open_bridges = list_open_bridges(conn)
if open_bridges:
payload["bridge_status"] = str(open_bridges[0].get("status") or "")
payload["bridge_underlying"] = str(open_bridges[0].get("underlying") or "")
except Exception:
pass
finally:
conn.close()
return jsonify(payload)
@app.route("/api/options/chain")
+6 -2
View File
@@ -185,7 +185,11 @@
<div class="card options-pos-card-wrap">
<div class="options-pos-head">
<h2>持仓</h2>
<button type="button" class="btn-secondary" id="opt-refresh-positions">刷新</button>
<div class="options-pos-head-actions">
<span id="opt-bridge-sell-hint" class="muted opt-bridge-sell-hint" hidden></span>
<button type="button" class="btn-secondary opt-retry-sell-coin-btn" id="opt-retry-sell-coin" hidden title="市价卖出交易账户全部可用标的币换回 USDT">重试卖回</button>
<button type="button" class="btn-secondary" id="opt-refresh-positions">刷新</button>
</div>
</div>
<div class="options-pos-tabs" role="tablist" aria-label="持仓面板">
<button type="button" class="btn-secondary opt-pos-tab active" data-opt-pos-tab="live" role="tab" aria-selected="true" id="opt-pos-tab-live">当前持仓</button>
@@ -351,4 +355,4 @@
</div>
</div>
<script src="/static/options_expiry_countdown.js?v=1"></script>
<script src="/static/options_panel.js?v=66"></script>
<script src="/static/options_panel.js?v=67"></script>