Files
qihuo/docs/TRADING.md
T
dekun 62cd868f79 完善下单表单与 CTP 持仓,requirements 加入 vnpy 并更新部署文档
以损定仓/固定张数分栏下单、限价市价、持仓仅读柜台;DEPLOY 补充 SimNow 与 vnpy 安装说明。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-24 10:52:25 +08:00

55 lines
1.9 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.
# 期货下单与策略交易
## 两种交易通道
| 设置 | 实际连接 | 资金 |
|------|----------|------|
| **模拟盘** | **SimNow**vnpy → CTP 仿真前置) | SimNow 账户权益 |
| **实盘** | **期货公司 CTP**(后期配置 `CTP_LIVE_*` | 柜台权益 |
已移除「本地 SQLite 假撮合」;模拟盘与实盘均走 **vnpy_ctp**,仅 `.env` 前置与账号不同。
## 依赖安装
`requirements.txt` 已包含 `vnpy``vnpy_ctp`。服务器部署:
```bash
cd /opt/qihuo
source venv/bin/activate
pip install -r requirements.txt
python -c "from vnpy_ctp import CtpGateway; print('OK')"
```
详见 [DEPLOY.md](./DEPLOY.md) 中「CTP / vnpy 故障排查」。
## 首次使用 SimNow
1. 在 [SimNow](https://www.simnow.com.cn/) 注册仿真账号
2. 复制 `.env.example``.env`,填写 `SIMNOW_USER``SIMNOW_PASSWORD`
3. 核对 SimNow 官网最新的 **7×24 或交易时段** 前置地址
4. `pip install -r requirements.txt`(含 vnpy、vnpy_ctp
5. 启动程序 → **持仓监控** → 点击 **连接 CTP**
6. 连接成功后,权益、持仓、下单均来自 SimNow 柜台
## 参考资金
系统设置中的「参考资金」仅在 **CTP 未连接** 时用于品种推荐与以损定仓估算;连接 SimNow 后自动改用柜台权益。
## 导航
| 页面 | 路径 |
|------|------|
| 持仓监控(含下单、推荐) | `/positions` |
| 策略交易 | `/strategy` |
| 策略记录 | `/strategy/records` |
## API
| 接口 | 说明 |
|------|------|
| `POST /api/ctp/connect` | 按当前模式连接 SimNow 或实盘 CTP |
| `GET /api/ctp/status` | 连接状态与缺失配置项 |
| `POST /api/trade/order` | 报单(限价/市价,需已连接 CTP) |
| `GET /api/trading/live` | 持仓(CTP 柜台数据) |
| `GET /api/recommend/stream` | 品种推荐 SSE 推送 |