diff --git a/crypto_monitor_binance/templates/index.html b/crypto_monitor_binance/templates/index.html index e6c487a..a3858ac 100644 --- a/crypto_monitor_binance/templates/index.html +++ b/crypto_monitor_binance/templates/index.html @@ -377,7 +377,7 @@
- {% from 'trade_policy_fields.html' import trade_policy_symbol, trade_policy_direction %} + {% from 'trade_policy_fields.html' import trade_policy_symbol, trade_policy_direction with context %} {{ trade_policy_symbol('symbol', 'order-symbol') }} {{ trade_policy_direction('direction', 'order-direction') }} diff --git a/crypto_monitor_okx/templates/index.html b/crypto_monitor_okx/templates/index.html index a9b8fa6..a697191 100644 --- a/crypto_monitor_okx/templates/index.html +++ b/crypto_monitor_okx/templates/index.html @@ -386,7 +386,7 @@
- {% from 'trade_policy_fields.html' import trade_policy_symbol, trade_policy_direction %} + {% from 'trade_policy_fields.html' import trade_policy_symbol, trade_policy_direction with context %} {{ trade_policy_symbol('symbol', 'order-symbol') }} {{ trade_policy_direction('direction', 'order-direction') }} diff --git a/lib/strategy/templates/key_focus_v2.html b/lib/strategy/templates/key_focus_v2.html index 6fbd0b6..fde6f65 100644 --- a/lib/strategy/templates/key_focus_v2.html +++ b/lib/strategy/templates/key_focus_v2.html @@ -34,7 +34,7 @@
- {% from 'trade_policy_fields.html' import trade_policy_symbol %} + {% from 'trade_policy_fields.html' import trade_policy_symbol with context %} {{ trade_policy_symbol('symbol', 'symbol-input', default_symbol, placeholder='BTC/USDT') }} {% if position_sizing_mode != 'full_margin' %} diff --git a/lib/strategy/templates/strategy_trend_panel.html b/lib/strategy/templates/strategy_trend_panel.html index 7e5271a..9c17d30 100644 --- a/lib/strategy/templates/strategy_trend_panel.html +++ b/lib/strategy/templates/strategy_trend_panel.html @@ -24,7 +24,7 @@ {% endfor %} {% endif %} - {% from 'trade_policy_fields.html' import trade_policy_symbol, trade_policy_direction %} + {% 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') }} diff --git a/lib/strategy/templates/trade_policy_fields.html b/lib/strategy/templates/trade_policy_fields.html index fe63bd3..373fa23 100644 --- a/lib/strategy/templates/trade_policy_fields.html +++ b/lib/strategy/templates/trade_policy_fields.html @@ -1,4 +1,7 @@ -{# 方向 / 币种:env 账户级限制(三所共用宏) #} +{# 方向 / 币种:env 账户级限制(三所共用宏);调用方须 with context #} +{% 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, 'direction_mode': 'both', 'badge_text': ''} %} +{% endif %} {% macro trade_policy_symbol(name, id, value='', required=true, placeholder='BTC 或 BTC/USDT') -%} {% if trade_policy.symbol_restrict_enabled and trade_policy.symbol_whitelist %}