Files
qihuo/docs/ORDER_MONITOR.md
T
2026-06-30 20:22:42 +08:00

60 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 下单监控 · 个人用户版
**页面路径**`/positions`(默认首页)
**相关文件**`install_trading.py``sl_tp_guard.py``pending_order_worker.py``product_recommend.py`
---
## 功能结构
| 区域 | 说明 |
|------|------|
| 顶栏 | 模拟/实盘、CTP 状态、风险状态、权益、连接按钮 |
| 期货下单 | 手动开仓/平仓表单 |
| 当前持仓 | pending 挂单 + active 持仓卡片 |
个人用户版 **不含**「可开仓品种」筛选大表。
---
## 下单逻辑
### 手动开仓
1. 选择品种、方向、限价/市价(FAK)、手数或计仓模式。
2. **前置校验**(全部通过才报单):
- CTP 已连接且不在连接中
- 处于 **交易时段**
- `assert_can_open()` — 见 [RISK.md](./RISK.md)
- `assert_product_allowed_for_capital()` — 小账户四品种限制
- 固定金额模式须填 **止损价**
- 开启 **移动保本** 须填止损(不可只填止盈)
- 保证金占用 ≤ `max_margin_pct`
- 单笔手数 ≤ 50
3. **计仓**
- 固定手数 → 使用 `fixed_lots`
- 固定金额 → `calc_lots_by_amount()` 按止损距离算手数
4. **报单**`execute_order()` → CTP。
5. **成交后**
- 写入 `trade_order_monitors`status=active 或 pending
- 注册本地 SL/TP 守护(`sl_tp_guard`
### 小账户四品种
权益 ≤20 万或未连 CTP 时,非 `c` / `m` / `MA` / `rb` 品种开仓会被拒绝。品种下拉同样受限。
---
## 移动保本
见 [TRADING.md](./TRADING.md) 与完整版 ORDER_MONITOR 说明(逻辑相同)。
---
## 相关文档
- [TRADING.md](./TRADING.md)
- [RISK.md](./RISK.md)
- [RELEASE-v1.0.0-user.md](./RELEASE-v1.0.0-user.md)