Polymarket Candle Momentum
Trade Polymarket 5-minute crypto fast markets using candle body analysis and volume surge detection from Binance. A stronger, data-driven alternative to simple momentum signals.
This is a template. The default signal uses Binance 1-minute candle structure (body/range ratio + volume surge). Remix it with your own thresholds, additional indicators, or alternative data sources. The skill handles all the plumbing (market discovery, import, trade execution). Your agent provides the alpha.
Fast markets carry Polymarket's 10% fee (is_paid: true). The default thresholds are calibrated to maintain edge after fees.
The Signal
Most fast-market skills use simple price momentum (did price go up or down?). This skill looks at how price moved:
- 1. Candle Body Ratio - Measures the last 1-minute candle's body size relative to its full range. A body ratio > 60% means a decisive move with minimal wicks (strong conviction, not noise).
- 2. Volume Surge - Confirms the move with volume. The last candle's volume must be > 1.5x the average of the previous 3 candles. High volume + strong body = real move, not a fake-out.
- 3. Direction Alignment - Body direction (bullish/bearish) must align with the 5-minute momentum direction.
Why This Works Better
Simple momentum catches every wiggle. Candle body analysis filters for quality moves:
- - A 0.5% move on a doji candle (long wicks, tiny body) = noise. Skip.
- A 0.3% move on a marubozu candle (90% body, no wicks) = conviction. Trade.
Backtested on BTC/ETH/SOL/XRP/BNB (3 months, 6131 five-minute slots):
- -
body > 65% + volume > 1.5x: 86.3% win rate (N=292) - INLINECODE2 : 84.7% win rate (N=333)
Setup
pip dependencies: simmer-sdk, INLINECODE4
Environment variables:
- -
SIMMER_API_KEY (required) - get from simmer.markets/dashboard
No other credentials needed. The script only reads SIMMER_API_KEY from the environment. All trades go through SimmerClient.trade() - no wallet private key, no direct CLOB access.
CODEBLOCK0
How to Run on a Loop
The script runs one cycle. Set up a cron (every 2 min recommended for 5min markets):
CODEBLOCK1
Security Notes
- - Only
SIMMER_API_KEY is read from environment. Nothing else. - No host files are read. No logs written outside the script's own stdout.
- INLINECODE9 is
false - the skill does not auto-execute. - Dry-run by default.
--live must be passed explicitly.
Trade Execution Path
- 1. Fetches Binance public klines (no auth) for BTC, ETH, SOL, XRP, BNB
- Scans all 5 assets, picks strongest signal (bodyratio x volsurge score)
- Finds matching Polymarket fast market via INLINECODE12
- If
--live: calls SimmerClient.trade() with side, amount, reasoning - If dry-run: logs the signal, no trade placed
Configuration
Via environment variables only (no local file persistence):
CODEBLOCK2
Settings
| Setting | Default | Env Var | Description |
|---|
| INLINECODE15 | 0.60 | INLINECODE16 | Min candle body/range ratio (0-1) |
| INLINECODE17 |
1.5 |
CM_VOL_THRESHOLD | Min volume surge vs 3-candle average |
|
max_position | 5.0 |
CM_MAX_POSITION | Max USD per trade |
|
assets | BTC,ETH,SOL,XRP,BNB | - | Assets to scan (picks best signal) |
|
asset | BTC |
CM_ASSET | Single asset override (ignores
assets) |
|
window | 5m |
CM_WINDOW | Market window (5m or 15m) |
|
min_time_remaining | 60 |
CM_MIN_TIME | Skip markets with less time (seconds) |
|
lookback_candles | 3 |
CM_LOOKBACK | Candles for volume average |
|
entry_threshold | 0.05 |
CM_ENTRY_THRESHOLD | Min price divergence from 50c |
CLI Options
CODEBLOCK3
Remix Ideas
The candle body + volume signal is just the starting point. Ideas:
- - Multi-timeframe: Confirm 1m signal with 5m candle structure
- Wick analysis: Filter out candles with long upper wicks (rejection)
- RSI filter: Skip overbought/oversold conditions
- Multi-exchange: Compare candle patterns across Binance + Coinbase
- Order flow: Add Polymarket CLOB depth as confirmation
To customize, edit get_candle_signal() in candle_momentum.py.
Example Output
CODEBLOCK4
Source
All trades tagged with source: "sdk:candle-momentum" for portfolio tracking.
Polymarket 蜡烛动量
使用币安的蜡烛实体分析和成交量激增检测来交易 Polymarket 5分钟加密货币快速市场。比简单的动量信号更强大、更数据驱动。
这是一个模板。 默认信号使用币安1分钟蜡烛结构(实体/范围比率 + 成交量激增)。您可以使用自己的阈值、额外指标或其他数据源进行重新组合。该技能处理所有底层工作(市场发现、导入、交易执行)。您的智能体提供阿尔法收益。
快速市场收取 Polymarket 10% 的费用(is_paid: true)。默认阈值已校准,以在扣除费用后保持优势。
信号
大多数快速市场技能使用简单的价格动量(价格是上涨还是下跌?)。该技能关注价格如何变动:
- 1. 蜡烛实体比率 - 衡量最后一根1分钟蜡烛的实体大小相对于其完整范围的比例。实体比率 > 60% 意味着具有最小影线的决定性变动(强烈共识,而非噪音)。
- 2. 成交量激增 - 通过成交量确认变动。最后一根蜡烛的成交量必须 > 前3根蜡烛平均成交量的1.5倍。高成交量 + 强实体 = 真实变动,而非假突破。
- 3. 方向一致性 - 实体方向(看涨/看跌)必须与5分钟动量方向一致。
为何更有效
简单的动量会捕捉每一次波动。蜡烛实体分析则筛选高质量的变动:
- - 十字星蜡烛(长影线,小实体)上的0.5%变动 = 噪音。跳过。
- 光头光脚蜡烛(90%实体,无影线)上的0.3%变动 = 共识。交易。
在BTC/ETH/SOL/XRP/BNB上回测(3个月,6131个五分钟时段):
- - 实体 > 65% + 成交量 > 1.5倍:86.3%胜率(N=292)
- 实体 > 60% + 成交量 > 1.5倍:84.7%胜率(N=333)
设置
pip依赖: simmer-sdk,requests
环境变量:
- - SIMMERAPIKEY(必需)- 从 simmer.markets/dashboard 获取
无需其他凭证。脚本仅从环境中读取 SIMMERAPIKEY。所有交易通过 SimmerClient.trade() 进行 - 无需钱包私钥,无需直接访问CLOB。
bash
export SIMMERAPIKEY=yourkeyhere
模拟运行(默认,不执行交易)
python candle_momentum.py
通过 SimmerClient 进行实盘交易
python candle_momentum.py --live
安静模式(用于cron)
python candle_momentum.py --live --quiet
如何循环运行
脚本运行一个周期。设置cron(对于5分钟市场,建议每2分钟运行一次):
bash
/2 * cd /path/to/skill && SIMMERAPIKEY=yourkey python candlemomentum.py --live --quiet
安全说明
- - 仅从环境读取 SIMMERAPIKEY。不读取其他任何内容。
- 不读取主机文件。除脚本自身的标准输出外,不写入日志。
- automaton.managed 为 false - 该技能不会自动执行。
- 默认为模拟运行。必须显式传递 --live 参数。
交易执行路径
- 1. 获取币安公开K线数据(无需认证),涵盖BTC、ETH、SOL、XRP、BNB
- 扫描所有5种资产,选择最强信号(实体比率 x 成交量激增得分)
- 通过 SimmerClient 找到匹配的Polymarket快速市场
- 如果使用 --live:调用 SimmerClient.trade(),包含方向、金额和推理
- 如果是模拟运行:记录信号,不执行交易
配置
仅通过环境变量(不持久化本地文件):
bash
python candlemomentum.py --set bodythreshold=0.65
python candle_momentum.py --set asset=ETH
python candlemomentum.py --set volthreshold=2.0
设置
| 设置 | 默认值 | 环境变量 | 描述 |
|---|
| bodythreshold | 0.60 | CMBODYTHRESHOLD | 最小蜡烛实体/范围比率(0-1) |
| volthreshold |
1.5 | CM
VOLTHRESHOLD | 相对于3根蜡烛平均成交量的最小激增倍数 |
| max
position | 5.0 | CMMAX_POSITION | 每笔交易最大美元金额 |
| assets | BTC,ETH,SOL,XRP,BNB | - | 要扫描的资产(选择最佳信号) |
| asset | BTC | CM_ASSET | 单一资产覆盖(忽略 assets) |
| window | 5m | CM_WINDOW | 市场窗口(5m或15m) |
| min
timeremaining | 60 | CM
MINTIME | 跳过剩余时间不足的市场(秒) |
| lookback
candles | 3 | CMLOOKBACK | 用于计算成交量平均值的蜡烛数量 |
| entry
threshold | 0.05 | CMENTRY_THRESHOLD | 与50美分的最小价格偏离 |
CLI选项
bash
python candle_momentum.py # 模拟运行
python candle_momentum.py --live # 实盘交易
python candle_momentum.py --live --quiet # 静默模式
python candle_momentum.py --positions # 显示持仓
python candle_momentum.py --config # 显示配置
python candle_momentum.py --set KEY=VALUE # 更新配置
重新组合思路
蜡烛实体 + 成交量信号只是起点。思路:
- - 多时间框架:用5分钟蜡烛结构确认1分钟信号
- 影线分析:过滤掉上影线较长的蜡烛(拒绝信号)
- RSI过滤器:跳过超买/超卖条件
- 多交易所:比较币安 + Coinbase的蜡烛模式
- 订单流:添加Polymarket CLOB深度作为确认
如需自定义,请编辑 candlemomentum.py 中的 getcandle_signal() 函数。
示例输出
Polymarket 蜡烛动量交易者
==================================================
[模拟运行] 使用 --live 启用交易。
配置:
资产: BTC
实体阈值: 0.60(最小蜡烛实体比率)
成交量阈值: 1.5倍(最小成交量激增)
最大仓位: $5.00
发现BTC快速市场...
找到3个活跃快速市场
已选择:Bitcoin Up or Down - 3月19日,东部时间10:30-10:35AM
到期时间:210秒
当前YES价格:$0.490
获取BTC蜡烛数据(币安)...
最后一根蜡烛:O=84250 H=84312 L=84245 C=84305
实体比率:0.90(强!)
方向:看涨
成交量激增:平均值的2.3倍
信号:买入YES(实体=0.90,成交量=2.3倍,方向=上涨)
偏离:5美分(YES为0.49,预期约0.54)
[模拟运行] 将买入 $5.00 YES
来源
所有交易标记有 source: sdk:candle-momentum,用于投资组合追踪。