fix: hide hub close/entrust controls for intraday discipline profile

Expose intraday_discipline via hub meta and block manual close/tpsl APIs; Gate instance card no longer shows 全平/平仓/委托.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-06 02:26:22 +08:00
parent a268a93027
commit 4904a86e03
8 changed files with 119 additions and 22 deletions
+10
View File
@@ -207,6 +207,7 @@ def order_entry_template_context(policy: TradePolicy) -> dict:
opts = entry_model_options()
return {
"order_entry_profile": profile,
"intraday_discipline": profile == PROFILE_INTRADAY,
"entry_model_options": [
{"code": o.code, "label": o.label, "trade_style": o.trade_style, "help": o.help}
for o in opts
@@ -215,6 +216,15 @@ def order_entry_template_context(policy: TradePolicy) -> dict:
}
def hub_meta_entry_context(policy: TradePolicy) -> dict:
"""供 /api/hub/meta:中控按 profile 隐藏平仓/委托等。"""
profile = order_entry_profile(policy)
return {
"order_entry_profile": profile,
"intraday_discipline": profile == PROFILE_INTRADAY,
}
def migrate_entry_model_columns(conn) -> None:
for table in ("order_monitors", "trade_records"):
try: