Files
qihuo/docs/TRADING.md
T
dekun 7b60f0dce5 Update documentation to match current product features.
Rewrite module docs for order monitor, CTP sync, and stats; remove obsolete simulated-position and UI descriptions.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 02:08:01 +08:00

73 lines
2.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`)。页面包含:
| 区域 | 说明 |
|------|------|
| 顶栏 | 交易模式、CTP 状态、权益/可用、连接 CTP |
| 期货下单 | 限价/市价报单、止盈止损、以损定仓/固定手数 |
| 当前持仓 | CTP 持仓卡片、挂单中、撤单、平仓 |
| 品种推荐 | 按权益筛选、行业分类、走势/跳空/成交量排序 |
`/trade``/recommend` 均重定向到 `/positions`(推荐锚点 `#recommend`)。
## 两种交易通道
| 设置 | 实际连接 | 资金 |
|------|----------|------|
| **模拟盘** | SimNowvnpy → CTP 仿真前置) | SimNow 账户权益 |
| **实盘** | 期货公司 CTP`.env``CTP_LIVE_*` | 柜台权益 |
模拟盘与实盘均走 **vnpy_ctp**,无本地假撮合。
## 下单与持仓
- **限价开仓**:先显示「挂单中」,柜台成交后进入持仓监控;超时未成交自动撤单(时长见系统设置)
- **撤单**:交易时段内可手动撤单;非交易时段按钮不可用
- **平仓**:程序平仓写入 `trade_logs`(来源「本地」)
- **持仓数据**SSE `/api/trading/stream` 推送,约 1 秒刷新
## 品种推荐
- 每日后台刷新可开品种列表(`/api/recommend/stream`
- 最大手数 = floor(权益 × 保证金上限 ÷ 1 手保证金)
- 展示近一周日线走势、跳空、昨日成交量(手)、成交额
- 可按 **行业** 筛选,支持多字段排序
## 策略交易
| 页面 | 路径 |
|------|------|
| 策略交易 | `/strategy` |
| 策略记录 | `/strategy/records` |
趋势回调、顺势加仓等策略需先在下单监控完成开仓,再在策略页配置。
## 参考资金
系统设置中的「参考资金」仅在 **CTP 未连接** 时用于品种推荐与以损定仓估算;连接后自动改用柜台权益。
## 首次使用 SimNow
完整步骤见 **[SimNow 注册与接入说明](./SIMNOW.md)**。
简要:注册 SimNow → 填写 `.env` → 安装 vnpy_ctp → 登录系统 → **下单监控****连接 CTP**
## 主要 API
| 接口 | 说明 |
|------|------|
| `POST /api/ctp/connect` | 连接 SimNow 或实盘 CTP |
| `GET /api/ctp/status` | 连接状态 |
| `POST /api/trade/order` | 报单(需已连接 CTP |
| `POST /api/trading/order/cancel` | 撤单(交易时段) |
| `POST /api/trading/close` | 平仓 |
| `GET /api/trading/stream` | 持仓 SSE |
| `GET /api/recommend/list` | 品种推荐 JSON |
| `GET /api/recommend/stream` | 品种推荐 SSE |
| `POST /api/strategy/trend/execute` | 执行趋势策略 |
详见 [DEPLOY.md](./DEPLOY.md) 中 CTP 故障排查。