divergence
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDivergence Trading - Spot vs Poly Price Lag
价差交易 - 现货与Polymarket价格滞后策略
Detects when Binance spot prices move but Polymarket 15-minute binary markets haven't caught up yet. Buys the lagging side and sells when it corrects.
Strategy tags match the CLAUDE.md encoding: (0.12-0.14% move in 15s window).
BTC_DOWN_s12-14_w15Starts in dry-run mode by default (no real orders).
当Binance现货价格变动,但Polymarket的15分钟二元市场尚未跟上时进行检测。买入滞后的一方,并在价格修正时卖出。
策略标签与CLAUDE.md的编码规则一致:(15秒窗口期内变动0.12-0.14%)。
BTC_DOWN_s12-14_w15默认以dry-run模式启动(不会下达真实订单)。
Quick Start
快速开始
/div start # Dry-run on BTC,ETH,SOL,XRP
/div start BTC,ETH --size 30 # Specific assets + size
/div status # Stats, open positions
/div stop # Stop and show summary/div start # 对BTC、ETH、SOL、XRP进行模拟运行
/div start BTC,ETH --size 30 # 指定资产及交易规模
/div status # 查看统计数据、未平仓头寸
/div stop # 停止运行并显示汇总信息Commands
命令说明
Start / Stop
启动/停止
/div start [ASSETS] [--size N] [--dry-run]
/div stop/div start [ASSETS] [--size N] [--dry-run]
/div stopMonitor
监控
/div status Stats + open positions + round info
/div positions Last 20 closed trades with strategy tags
/div markets Active 15-min markets from Gamma API/div status 统计数据 + 未平仓头寸 + 周期信息
/div positions 最近20笔平仓交易及策略标签
/div markets 从Gamma API获取的活跃15分钟市场数据Configure
配置
/div config Show current config
/div config --tp 20 --sl 30 Set TP/SL %
/div config --size 50 Set trade size
/div config --windows 5,10,30 Set detection windows/div config 查看当前配置
/div config --tp 20 --sl 30 设置止盈/止损比例
/div config --size 50 设置交易规模
/div config --windows 5,10,30 设置检测窗口期Detection Algorithm
检测算法
For each spot tick, across all configured windows (5s, 10s, 15s, 30s, 60s, 90s, 120s):
- Look up spot price N seconds ago via binary search
- Calculate
spotMovePct = (now - then) / then * 100 - If move >= threshold AND poly is fresh (< 5s stale):
- Generate signal with strategy tag:
{ASSET}_{DIR}_s{bucket}_w{window} - e.g., = 0.12-0.14% spot drop over 15s
BTC_DOWN_s12-14_w15
- Generate signal with strategy tag:
针对每一个现货报价,在所有配置的窗口期(5秒、10秒、15秒、30秒、60秒、90秒、120秒)内执行以下操作:
- 通过二分查找获取N秒前的现货价格
- 计算
spotMovePct = (当前价格 - 历史价格) / 历史价格 * 100 - 如果价格变动幅度≥阈值且Polymarket数据最新(过期时间<5秒):
- 生成带有策略标签的信号:
{ASSET}_{DIR}_s{bucket}_w{window} - 示例:= 15秒内现货价格下跌0.12-0.14%
BTC_DOWN_s12-14_w15
- 生成带有策略标签的信号:
Threshold Buckets
阈值区间
| Bucket | Spot Move Range |
|---|---|
| s08-10 | 0.08% - 0.10% |
| s10-12 | 0.10% - 0.12% |
| s12-14 | 0.12% - 0.14% |
| s14-16 | 0.14% - 0.16% |
| s16-20 | 0.16% - 0.20% |
| s20+ | 0.20%+ |
| 区间 | 现货价格变动范围 |
|---|---|
| s08-10 | 0.08% - 0.10% |
| s10-12 | 0.10% - 0.12% |
| s12-14 | 0.12% - 0.14% |
| s14-16 | 0.14% - 0.16% |
| s16-20 | 0.16% - 0.20% |
| s20+ | 0.20%+ |
Exit Logic
离场逻辑
- Force exit — < 30s before market expiry
- Take profit — PnL >= 15% (configurable)
- Stop loss — PnL <= -25% (configurable)
- Trailing stop — Activated at +10%, exits if drops 8% from HWM
- Time exit — < 2min before expiry
- 强制离场 — 市场到期前30秒内
- 止盈离场 — 盈亏比≥15%(可配置)
- 止损离场 — 盈亏比≤-25%(可配置)
- 追踪止损 — 盈利达到10%时激活,若从最高盈利点回落8%则离场
- 时间离场 — 市场到期前2分钟内