ec1c9873b7
Co-authored-by: Cursor <cursoragent@cursor.com>
1.7 KiB
1.7 KiB
下单监控 · 个人用户版
页面路径:/positions(默认首页)
相关文件:install_trading.py、sl_tp_guard.py、pending_order_worker.py、product_recommend.py
功能结构
| 区域 | 说明 |
|---|---|
| 顶栏 | 模拟/实盘、CTP 状态、风险状态、权益、连接按钮 |
| 期货下单 | 手动开仓/平仓表单 |
| 当前持仓 | pending 挂单 + active 持仓卡片 |
个人用户版 不含「可开仓品种」筛选大表。
下单逻辑
手动开仓
- 选择品种、方向、限价/市价(FAK)、手数或计仓模式。
- 前置校验(全部通过才报单):
- CTP 已连接且不在连接中
- 处于 交易时段
assert_can_open()— 见 RISK.mdassert_product_allowed_for_capital()— 小账户四品种限制- 固定金额模式须填 止损价
- 开启 移动保本 须填止损(不可只填止盈)
- 保证金占用 ≤
max_margin_pct - 单笔手数 ≤ 50
- 计仓:
- 固定手数 → 使用
fixed_lots - 固定金额 →
calc_lots_by_amount()按止损距离算手数
- 固定手数 → 使用
- 报单:
execute_order()→ CTP。 - 成交后:
- 写入
trade_order_monitors(status=active 或 pending) - 注册本地 SL/TP 守护(
sl_tp_guard)
- 写入
小账户四品种
权益 ≤20 万或未连 CTP 时,非 c / m / MA / rb 品种开仓会被拒绝。品种下拉同样受限。
移动保本
见 TRADING.md 与完整版 ORDER_MONITOR 说明(逻辑相同)。