From 3a740235ac0eca1061ffb2431b616aa6a7311c9c Mon Sep 17 00:00:00 2001 From: dekun Date: Sun, 5 Jul 2026 00:42:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B8=81=E7=A7=8D=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=97=81=E5=AE=9E=E6=97=B6=E6=98=BE=E7=A4=BA=E4=BA=A4=E6=98=93?= =?UTF-8?q?=E6=89=80=E7=8E=B0=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Shared SymbolLivePrice polls /api/order_defaults on input with debounce; wired to trade, key monitor, trend, and key focus forms. Co-authored-by: Cursor --- crypto_monitor_binance/templates/index.html | 13 +- crypto_monitor_gate/templates/index.html | 13 +- crypto_monitor_okx/templates/index.html | 13 +- lib/common/static/instance_embed.js | 4 + lib/common/static/instance_theme.css | 48 ++++++ lib/common/static/symbol_live_price.js | 163 ++++++++++++++++++ .../templates/embed_boot_scripts.html | 5 +- .../templates/embed_page_fragment.html | 4 +- lib/instance/templates/embed_shell.html | 3 +- lib/strategy/templates/key_focus_v2.html | 7 +- lib/strategy/templates/key_monitor_panel.html | 2 + .../templates/strategy_trend_panel.html | 2 + .../templates/symbol_live_price_snippet.html | 10 ++ 13 files changed, 273 insertions(+), 14 deletions(-) create mode 100644 lib/common/static/symbol_live_price.js create mode 100644 lib/strategy/templates/symbol_live_price_snippet.html diff --git a/crypto_monitor_binance/templates/index.html b/crypto_monitor_binance/templates/index.html index a3858ac..44223cc 100644 --- a/crypto_monitor_binance/templates/index.html +++ b/crypto_monitor_binance/templates/index.html @@ -243,7 +243,7 @@ .stats-period-block h3{font-size:1rem;color:#dbe4ff;margin-bottom:4px} .stats-period-block .sub{font-size:.78rem;color:#8892b0;margin-bottom:10px;line-height:1.4} - + {% macro period_stats(title, s) %}
@@ -408,7 +409,9 @@ - 成交价自动取交易所实时+成交回报 + {% from 'symbol_live_price_snippet.html' import symbol_live_price_hint %} + {{ symbol_live_price_hint('order-symbol-live-price', 'order-symbol', 'order-direction') }} + 下单成交价以交易所成交回报为准 @@ -848,6 +851,7 @@ + + + {{ exchange_display }} · 加密货币 | 交易监控复盘系统 @@ -121,6 +121,7 @@ + {% include 'embed_boot_scripts.html' %} diff --git a/lib/strategy/templates/key_focus_v2.html b/lib/strategy/templates/key_focus_v2.html index fde6f65..ee8d7ea 100644 --- a/lib/strategy/templates/key_focus_v2.html +++ b/lib/strategy/templates/key_focus_v2.html @@ -4,10 +4,11 @@ {{ exchange_display }} | 关键位放大 - + + - + {% if trade_policy is not defined %} {% set trade_policy = {'symbol_restrict_enabled': false, 'direction_restrict_enabled': false, 'symbol_whitelist': [], 'allows_long': true, 'allows_short': true, 'badge_text': ''} %} {% endif %} @@ -36,6 +37,8 @@ {% from 'trade_policy_fields.html' import trade_policy_symbol with context %} {{ trade_policy_symbol('symbol', 'symbol-input', default_symbol, placeholder='BTC/USDT') }} + {% from 'symbol_live_price_snippet.html' import symbol_live_price_hint %} + {{ symbol_live_price_hint('key-focus-symbol-live-price', 'symbol-input') }} {{ trade_policy_direction('direction', 'key-direction') }} + {% from 'symbol_live_price_snippet.html' import symbol_live_price_hint %} + {{ symbol_live_price_hint('key-symbol-live-price', 'key-symbol', 'key-direction') }} diff --git a/lib/strategy/templates/strategy_trend_panel.html b/lib/strategy/templates/strategy_trend_panel.html index 9c17d30..bbeaf1f 100644 --- a/lib/strategy/templates/strategy_trend_panel.html +++ b/lib/strategy/templates/strategy_trend_panel.html @@ -27,6 +27,8 @@ {% from 'trade_policy_fields.html' import trade_policy_symbol, trade_policy_direction with context %} {{ trade_policy_symbol('symbol', 'trend-symbol', placeholder='BTC 或 ETH/USDT') }} {{ trade_policy_direction('direction', 'trend-direction') }} + {% from 'symbol_live_price_snippet.html' import symbol_live_price_hint %} + {{ symbol_live_price_hint('trend-symbol-live-price', 'trend-symbol', 'trend-direction') }} diff --git a/lib/strategy/templates/symbol_live_price_snippet.html b/lib/strategy/templates/symbol_live_price_snippet.html new file mode 100644 index 0000000..a969f87 --- /dev/null +++ b/lib/strategy/templates/symbol_live_price_snippet.html @@ -0,0 +1,10 @@ +{# 币种输入旁实时现价(须加载 symbol_live_price.js) #} +{% macro symbol_live_price_hint(price_id, symbol_input_id, direction_input_id='') -%} +现价:— +{%- endmacro %}