本地监控止盈止损、盘前自动连CTP,并完善保证金与推荐手数。

- 止盈止损改为程序本地监控,触发后市价平仓(含跳空)
- 交易前30分钟后台自动连接 CTP
- 保证金占用上限默认30%,可在系统设置修改
- K线标准蜡烛图红跌绿涨,费率表全宽固定表头
- 品种推荐按保证金比例×总资金计算推荐手数

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-25 12:18:18 +08:00
parent fe1b651900
commit 9875ee6d44
15 changed files with 467 additions and 256 deletions
+4 -1
View File
@@ -32,10 +32,13 @@ def refresh_recommend_cache(
quote_fn: Callable[[str], Optional[dict]],
*,
trading_mode: str = "simulation",
max_margin_pct: float = 30.0,
) -> list[dict]:
"""后台拉行情、筛选并写入数据库。"""
ensure_recommend_tables(conn)
all_rows = list_product_recommendations(capital, quote_fn, trading_mode=trading_mode)
all_rows = list_product_recommendations(
capital, quote_fn, max_margin_pct=max_margin_pct, trading_mode=trading_mode,
)
rows = filter_affordable_recommendations(all_rows)
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
conn.execute(