Fix missing recommend_payload import; raise small-account cap to 200k.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+15
-4
@@ -18,12 +18,22 @@ from symbols import PRODUCTS, product_category, product_has_night_session
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# 权益低于该值时,仅允许下列品种(可开仓列表、品种下拉、开仓报单)
|
||||
SMALL_ACCOUNT_CAPITAL_MAX = 100_000.0
|
||||
# 权益不超过该值时,仅允许下列品种(可开仓列表、品种下拉、开仓报单)
|
||||
SMALL_ACCOUNT_CAPITAL_MAX = 200_000.0
|
||||
SMALL_ACCOUNT_PRODUCT_THS = frozenset({"c", "m", "MA", "rb"})
|
||||
SMALL_ACCOUNT_SCOPE_LABEL = "玉米、豆粕、甲醇、螺纹钢"
|
||||
|
||||
|
||||
def small_account_scope_hint() -> str:
|
||||
wan = int(SMALL_ACCOUNT_CAPITAL_MAX // 10_000)
|
||||
return f"权益 {wan} 万以下仅显示并可交易:{SMALL_ACCOUNT_SCOPE_LABEL}"
|
||||
|
||||
|
||||
def small_account_scope_status_label() -> str:
|
||||
wan = int(SMALL_ACCOUNT_CAPITAL_MAX // 10_000)
|
||||
return f"权益{wan}万以下限{SMALL_ACCOUNT_SCOPE_LABEL}"
|
||||
|
||||
|
||||
def normalize_product_ths(ths: str) -> str:
|
||||
import re
|
||||
s = (ths or "").strip()
|
||||
@@ -56,7 +66,8 @@ def assert_product_allowed_for_capital(ths: str, capital: float) -> Optional[str
|
||||
return None
|
||||
if product_in_small_account_whitelist(ths):
|
||||
return None
|
||||
return f"权益 10 万以下仅可交易:{SMALL_ACCOUNT_SCOPE_LABEL}"
|
||||
wan = int(SMALL_ACCOUNT_CAPITAL_MAX // 10_000)
|
||||
return f"权益 {wan} 万以下仅可交易:{SMALL_ACCOUNT_SCOPE_LABEL}"
|
||||
|
||||
|
||||
def filter_products_for_capital(products: list[dict], capital: float) -> list[dict]:
|
||||
@@ -115,7 +126,7 @@ def assess_product_for_capital(
|
||||
"mult": spec["mult"],
|
||||
"tick_size": tick,
|
||||
"status": "blocked",
|
||||
"status_label": f"10万以下限{SMALL_ACCOUNT_SCOPE_LABEL}",
|
||||
"status_label": small_account_scope_status_label(),
|
||||
"min_capital_one_lot": None,
|
||||
"margin_one_lot": None,
|
||||
"max_lots": 0,
|
||||
|
||||
Reference in New Issue
Block a user