diff --git a/crypto_monitor_okx/app.py b/crypto_monitor_okx/app.py index f3ec0f8..757ce21 100644 --- a/crypto_monitor_okx/app.py +++ b/crypto_monitor_okx/app.py @@ -6816,6 +6816,7 @@ def render_main_page(page="trade", embed_mode=None): risk_status=risk_status, trade_policy=TRADE_POLICY, data_export_version=3, + open_guard_enabled=open_guard_enabled, ), **force_close_template_context( FORCE_CLOSE_ENABLED, diff --git a/lib/common/static/instance_theme.css b/lib/common/static/instance_theme.css index 1405532..f1f538f 100644 --- a/lib/common/static/instance_theme.css +++ b/lib/common/static/instance_theme.css @@ -4791,14 +4791,19 @@ html[data-theme="light"] .opt-source-badge--oo { font-weight: 700; font-variant-numeric: tabular-nums; } -.options-page-wrap .opt-close-rule { +.options-page-wrap .opt-close-rule, +.options-page-wrap .opt-open-rule { margin-top: 8px; + margin-bottom: 10px; padding: 0; border: 1px solid rgba(67, 82, 118, 0.55); border-radius: 10px; background: rgba(14, 19, 30, 0.58); overflow: hidden; } +.options-page-wrap .opt-open-rule { + margin-top: 4px; +} .options-page-wrap .opt-close-rule summary { display: flex; align-items: center; diff --git a/lib/env/env_ui_manifest.py b/lib/env/env_ui_manifest.py index c75473f..378869d 100644 --- a/lib/env/env_ui_manifest.py +++ b/lib/env/env_ui_manifest.py @@ -67,7 +67,11 @@ _SHARED_SECTIONS: list[dict[str, Any]] = [ ("TRADE_SYMBOL_RESTRICT_ENABLED", "币种白名单开关", ""), ("TRADE_SYMBOL_WHITELIST", "白名单币种", "逗号分隔,如 BTC,ETH"), ("TRADING_DAY_RESET_HOUR", "交易日切点(北京时间)", "整点,默认 8"), - ("TRADING_DAY_RESET_OPEN_GUARD_ENABLED", "切点前禁止新开仓", ""), + ( + "TRADING_DAY_RESET_OPEN_GUARD_ENABLED", + "切点前禁止新开仓", + "默认 true;开启则北京时间切点前禁止斐波登记与人工开仓;说明见风控说明·交易执行", + ), ("MAX_ACTIVE_POSITIONS", "最大同时持仓", ""), ("MANUAL_MIN_PLANNED_RR", "人工最低盈亏比", "如 1.4"), ("KEY_AUTO_ORDER_ENABLED", "关键位自动单", "关闭后箱体/收敛/斐波等不自动开仓;支撑阻力提醒仍可用"), diff --git a/lib/instance/instance_settings_lib.py b/lib/instance/instance_settings_lib.py index cf1bcd7..8171796 100644 --- a/lib/instance/instance_settings_lib.py +++ b/lib/instance/instance_settings_lib.py @@ -53,6 +53,7 @@ def build_instance_settings_view( risk_status: Optional[dict[str, Any]] = None, trade_policy: Optional[TradePolicy] = None, data_export_version: int = 3, + open_guard_enabled: Optional[bool] = None, ) -> dict[str, Any]: rs = risk_status or {} sizing_mode = load_position_sizing_mode() @@ -63,6 +64,11 @@ def build_instance_settings_view( force_close_on = _env_bool("FORCE_CLOSE_ENABLED", False) force_close_hour = _env_int("FORCE_CLOSE_BJ_HOUR", 0) auto_transfer_on = _env_bool("AUTO_TRANSFER_ENABLED", False) + guard_on = ( + bool(open_guard_enabled) + if open_guard_enabled is not None + else _env_bool("TRADING_DAY_RESET_OPEN_GUARD_ENABLED", True) + ) sections: list[dict[str, Any]] = [] @@ -79,6 +85,12 @@ def build_instance_settings_view( f"北京时间 {reset_hour}:00", "新交易日统计与部分开仓限制以此为准", ), + _row( + "允许北京时间切点前开仓", + "已放开(允许开仓)" if not guard_on else "已限制(禁止开仓)", + f"关闭限制后,{reset_hour}:00 前也可斐波成交登记与人工下单;" + "环境配置「切点前禁止新开仓」(TRADING_DAY_RESET_OPEN_GUARD_ENABLED)", + ), _row( "单日开仓提醒", f"第 {alert_threshold} 次", diff --git a/lib/instance/templates/embed_shell.html b/lib/instance/templates/embed_shell.html index b7a5e5c..f285a2b 100644 --- a/lib/instance/templates/embed_shell.html +++ b/lib/instance/templates/embed_shell.html @@ -7,7 +7,7 @@ - +