Files
crypto_monitor/crypto_monitor_okx/README.md
T
dekun 1282293e91 docs: unify Ubuntu root /opt PM2 deployment and refresh README
Add docs/ubuntu-server.md; remove Windows and alternate process managers from deployment guides; index strategy, key monitor, TP/SL, breakeven, and replay docs in root README.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-04 11:48:54 +08:00

54 lines
2.2 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.
# crypto_monitor_okx
基于 **Flask** 的加密货币 **下单监控 / 关键位监控 / 交易复盘** 小系统,行情与实盘接口统一走 **OKXUSDT 永续)**,通过 **ccxt** 访问。功能与界面已与 **`crypto_monitor_binance`** 对齐(顶栏分栏、风控参数、交易所 TP/SL 管理等),差异主要在 **`.env``OKX_*` 变量** 与 OKX API(含 Passphrase)。
## 功能概要
- **关键位监控**`/key_monitor`,5m 门控、企业微信、部分类型自动开仓(见 `关键位自动下单说明.md`
- **实盘下单**`/trade`,以损定仓、移动保本、页面内撤挂止盈止损
- **策略交易**`/strategy`(趋势回调 + 顺势加仓),见 [策略交易说明.md](../策略交易说明.md)
- **AI 复盘**:见 [AI复盘与模型配置说明.md](../AI复盘与模型配置说明.md)
- **实盘(可选)**`LIVE_TRADING_ENABLED=true` 且配置 `OKX_API_KEY` / `OKX_API_SECRET` / `OKX_API_PASSPHRASE`
- **止盈止损(OKX)**:市价成交后通过 ccxt 挂 **止损 / 止盈** 条件单(`attachAlgoOrds` 或 reduceOnly 市价单路径,见 `app.py`
## 环境要求
- Python 3.10+
- 依赖见仓库根 `requirements.txt`;经 **SSH SOCKS** 访问 OKX 时需 **`PySocks`**,并配置 `OKX_SOCKS_PROXY=socks5h://127.0.0.1:1080`
## 配置说明
| 变量 | 说明 |
|------|------|
| `OKX_API_KEY` / `OKX_API_SECRET` / `OKX_API_PASSPHRASE` | OKX API |
| `OKX_TD_MODE` / `OKX_POS_MODE` | 全仓/逐仓、单向/双向 |
| `OKX_SOCKS_PROXY` | 本机 SSH 动态转发时常用 |
| `MAX_ACTIVE_POSITIONS` / `MANUAL_MIN_PLANNED_RR` | 与币安版一致的风控 |
| `EXCHANGE_DISPLAY_NAME` | 页面展示名,默认 `OKX` |
完整模板见 **`.env.example`**。
## 运行
```bash
cd /opt/crypto_monitor/crypto_monitor_okx
source .venv/bin/activate
python app.py
```
生产使用 **PM2**;见 [docs/ubuntu-server.md](../docs/ubuntu-server.md)。默认 **`APP_PORT`** 常为 `5004`
## 部署
详见 **[部署文档.md](./部署文档.md)**、**[使用说明.md](./使用说明.md)**。
## 自检
```bash
python scripts/verify_okx_funding.py
```
## 风险与合规
实盘风险自负;请确认 API 权限、IP 白名单与 OKX 账户设置一致。