Use 100k equity for recommend list when CTP is offline.

When SimNow or live CTP is disconnected, the tradable-products section shows four whitelisted symbols and calculates max lots from a fixed 100,000 capital instead of reference capital in settings.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-28 09:16:22 +08:00
parent e18d5feb72
commit 0109b59f27
7 changed files with 30 additions and 12 deletions
+4 -1
View File
@@ -20,6 +20,8 @@ logger = logging.getLogger(__name__)
# 权益不超过该值时,仅允许下列品种(可开仓列表、品种下拉、开仓报单)
SMALL_ACCOUNT_CAPITAL_MAX = 200_000.0
# 未连接 CTP 时,可开仓品种表按该权益估算最大手数(与参考资金设置无关)
DISCONNECTED_RECOMMEND_CAPITAL = 100_000.0
SMALL_ACCOUNT_PRODUCT_THS = frozenset({"c", "m", "MA", "rb"})
SMALL_ACCOUNT_SCOPE_LABEL = "玉米、豆粕、甲醇、螺纹钢"
@@ -27,8 +29,9 @@ SMALL_ACCOUNT_SCOPE_LABEL = "玉米、豆粕、甲醇、螺纹钢"
def small_account_scope_hint(*, ctp_connected: bool = True) -> str:
wan = int(SMALL_ACCOUNT_CAPITAL_MAX // 10_000)
if not ctp_connected:
rec_wan = int(DISCONNECTED_RECOMMEND_CAPITAL // 10_000)
return (
f"未连接 CTP默认{wan}以下账户:"
f"未连接 CTP,按 {rec_wan}权益估算最大手数,"
f"仅显示并可交易 {SMALL_ACCOUNT_SCOPE_LABEL}"
)
return f"权益 {wan} 万以下仅显示并可交易:{SMALL_ACCOUNT_SCOPE_LABEL}"