diff --git a/crypto_monitor_binance/app.py b/crypto_monitor_binance/app.py index ccaa1b1..3382d17 100644 --- a/crypto_monitor_binance/app.py +++ b/crypto_monitor_binance/app.py @@ -6888,6 +6888,9 @@ def render_main_page(page="trade"): request_obj=request, trend_cfg=app.extensions.get("strategy_trend_cfg"), ) + orphan_live_positions = [] + if not order_list and exchange_private_api_configured(): + orphan_live_positions = list_orphan_live_positions(conn) conn.close() return render_template( "index.html", @@ -6896,6 +6899,7 @@ def render_main_page(page="trade"): key_history=key_history, stats_bundle=stats_bundle, order=order_list, + orphan_live_positions=orphan_live_positions, record=records, total=total, miss_count=miss_count, diff --git a/crypto_monitor_binance/templates/index.html b/crypto_monitor_binance/templates/index.html index 7bc602b..f467954 100644 --- a/crypto_monitor_binance/templates/index.html +++ b/crypto_monitor_binance/templates/index.html @@ -402,7 +402,19 @@

实时持仓

+ {% if not order and orphan_live_positions %} + {% set o = orphan_live_positions[0] %} +
+ 检测到交易所仍有 {{ o.symbol }} {{ '空' if o.direction == 'short' else '多' }}仓,但本地监控已中断(误同步时可能无交易记录)。 + {% if o.recoverable_monitor_id %} + + {% else %} + 未找到可恢复的监控记录,需在服务器数据库处理。 + {% endif %} +
+ {% else %} + {% endif %}
{% for o in order %}
{}); }