Apply 200k scope when CTP offline; trailing breakeven order UX.

When SimNow or live CTP is disconnected, default to the four-product whitelist regardless of reference capital. Trailing breakeven defaults off; when enabled hide take-profit and risk-reward, monitor exits via trailing stop only. Document both behaviors in TRADING.md and FEATURES.md.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-27 23:57:11 +08:00
parent 4f4c4bb9fc
commit e18d5feb72
12 changed files with 220 additions and 48 deletions
+10 -6
View File
@@ -461,19 +461,21 @@ def _match_score(product: dict, q_lower: str) -> int:
return 10
def search_symbols(query: str, *, capital: float | None = None) -> list:
def search_symbols(query: str, *, capital: float | None = None, ctp_connected: bool = True) -> list:
q = query.strip()
if not q:
return []
q_lower = q.lower()
from market_sessions import is_night_trading_session
from product_recommend import filter_products_for_capital, is_small_account
from product_recommend import filter_products_for_capital, should_apply_small_account_scope
night_only = is_night_trading_session()
product_pool = PRODUCTS
if capital is not None and is_small_account(capital):
product_pool = filter_products_for_capital(PRODUCTS, capital)
if capital is not None and should_apply_small_account_scope(capital, ctp_connected=ctp_connected):
product_pool = filter_products_for_capital(
PRODUCTS, capital, ctp_connected=ctp_connected,
)
with _main_index_lock:
index = dict(_main_index)
index_ready = bool(index)
@@ -498,8 +500,10 @@ def search_symbols(query: str, *, capital: float | None = None) -> list:
codes = ths_to_codes(q)
if codes:
product = _product_for_contract_code(codes["ths_code"])
if capital is not None and is_small_account(capital):
from product_recommend import is_small_account, product_in_small_account_whitelist
if capital is not None and should_apply_small_account_scope(
capital, ctp_connected=ctp_connected,
):
from product_recommend import product_in_small_account_whitelist
if not product or not product_in_small_account_whitelist(product):
return results
raw = fetch_raw_for_volume(codes["sina_code"])