Candle -- Harami Pattern Trader
This is a template.
The default signal detects harami (inside bar) candlestick patterns in crypto 5-minute interval markets and trades the expected reversal using conviction-based sizing. The skill handles all the plumbing (interval parsing, pattern detection, trade execution, safeguards). Your agent provides the alpha.
Strategy Overview
Polymarket lists 5-minute interval markets for BTC, ETH, SOL, and XRP: "Will Bitcoin be Up or Down in the 10:50AM-10:55AM ET interval?" These resolve to YES (up) or NO (down) based on actual price movement. A harami (inside bar) pattern forms when a large-range interval (probability far from 50%, indicating a strong directional move) is immediately followed by a small-range interval (probability near 50%, indicating indecision). The small candle is "contained" within the body of the large one. This classic candlestick pattern signals that the strong move has lost momentum, and a reversal is likely on the next interval.
Edge
Unlike generic mean-reversion strategies that simply fade any extreme reading, this skill specifically targets the harami pattern -- a two-candle formation with a precise structural meaning:
- 1. Pattern recognition -- the harami is one of the most reliable reversal patterns in traditional technical analysis, adapted here to Polymarket's discrete 5-minute intervals
- Indecision after conviction -- a large candle shows strong directional conviction; a subsequent small candle near 50% shows that conviction has evaporated, creating a structural reversal setup
- Confirmation gating -- the skill checks the third interval (confirmation candle) and only trades if it hasn't already moved in the reversal direction, ensuring the edge hasn't been priced in
- Independent resolution -- each 5-minute interval resolves independently, so the harami pattern captures genuine shifts in market microstructure rather than mechanical carry-over
Signal Logic
- 1. Discover crypto interval markets via keyword search (
Bitcoin Up or Down, Ethereum Up or Down, Solana Up or Down, XRP Up or Down) with a get_markets(limit=200) fallback - Parse each question to extract (coin, date, starttimeminutes) using regex
- Group intervals by (coin, date) and sort by time
- Scan each group for consecutive pairs where:
- Interval N is
large: probability < 0.40 or > 0.60 (distance from 0.5 exceeds
HARAMI_LARGE)
- Interval N+1 is
small: probability between 0.48 and 0.52 (distance from 0.5 within
HARAMI_SMALL)
- 5. Determine harami direction:
-
Bullish harami: large DOWN (p < 0.40) followed by small neutral -> reversal UP expected
-
Bearish harami: large UP (p > 0.60) followed by small neutral -> reversal DOWN expected
- 6. Check interval N+2 (confirmation): only trade if it hasn't already moved in the reversal direction
- Size by conviction (distance from threshold), not flat amount
Remix Signal Ideas
- - Volume-weighted harami -- weight the pattern detection by trading volume; high-volume large candles followed by low-volume small candles produce stronger reversal signals
- Multi-timeframe confirmation -- check if the harami pattern aligns with a broader trend reversal across 15-minute or hourly aggregated intervals
- Cross-coin harami -- if BTC shows a harami and ETH/SOL show the same pattern simultaneously, the reversal signal is stronger (correlated exhaustion)
- Doji refinement -- distinguish between harami where the small candle is exactly 50% (doji) vs. slightly biased; true doji haramis have higher reversal rates
- Engulfing follow-up -- after a harami reversal, look for an engulfing pattern in the same direction to add to the position
Safety & Execution Mode
The skill defaults to paper trading (venue="sim"). Real trades only with --live flag.
| Scenario | Mode | Financial risk |
|---|
| INLINECODE9 | Paper (sim) | None |
| Cron / automaton |
Paper (sim) | None |
|
python trader.py --live | Live (polymarket) | Real USDC |
INLINECODE11 and cron: null mean nothing runs automatically until configured in Simmer UI.
Required Credentials
| Variable | Required | Notes |
|---|
| INLINECODE13 | Yes | Trading authority. Treat as a high-value credential. |
Tunables (Risk Parameters)
All declared as tunables in clawhub.json and adjustable from the Simmer UI.
| Variable | Default | Purpose |
|---|
| INLINECODE16 | INLINECODE17 | Max USDC per trade at full conviction |
| INLINECODE18 |
5 | Floor for any trade (min USDC regardless of conviction) |
|
SIMMER_MIN_VOLUME |
3000 | Min market volume filter (USD) |
|
SIMMER_MAX_SPREAD |
0.10 | Max bid-ask spread |
|
SIMMER_MIN_DAYS |
1 | Min days until resolution |
|
SIMMER_MAX_POSITIONS |
10 | Max concurrent open positions |
|
SIMMER_YES_THRESHOLD |
0.38 | Buy YES only if market probability <= this |
|
SIMMER_NO_THRESHOLD |
0.62 | Sell NO only if market probability >= this |
|
SIMMER_HARAMI_LARGE |
0.10 | Min distance from 0.5 for the large candle |
|
SIMMER_HARAMI_SMALL |
0.02 | Max distance from 0.5 for the small candle |
Edge Thesis
Crypto 5-minute interval markets on Polymarket exhibit classic candlestick reversal patterns. When a strong directional interval (far from 50%) is immediately followed by a neutral interval (near 50%), this harami formation signals that directional conviction has evaporated. The small candle represents market indecision after a strong move -- a well-known precursor to reversal in both traditional and crypto technical analysis. The skill exploits this by trading the confirmation interval in the reversal direction with conviction-based sizing that scales with the distance from the trading threshold.
Dependency
INLINECODE36 by Simmer Markets (SpartanLabsXyz)
- - PyPI: https://pypi.org/project/simmer-sdk/
- GitHub: https://github.com/SpartanLabsXyz/simmer-sdk
技能名称: polymarket-candle-harami-trader
详细描述:
蜡烛图——孕线形态交易者
这是一个模板。
默认信号检测加密货币5分钟间隔市场中的孕线(内含柱)蜡烛图形态,并基于信念度进行仓位调整,交易预期的反转走势。该技能处理所有底层逻辑(间隔解析、形态检测、交易执行、安全保护)。您的智能体提供阿尔法收益。
策略概述
Polymarket为BTC、ETH、SOL和XRP列出了5分钟间隔市场:比特币在美东时间上午10:50-10:55期间会上涨还是下跌?这些市场根据实际价格波动结算为YES(上涨)或NO(下跌)。当一个大范围间隔(概率远离50%,表明强烈方向性波动)之后紧跟着一个小范围间隔(概率接近50%,表明犹豫不决)时,就形成了孕线(内含柱)形态。小蜡烛被包含在大蜡烛的实体之内。这种经典蜡烛图形态表明强劲走势已失去动能,下一个间隔可能出现反转。
优势
与简单地反向交易任何极端读数的通用均值回归策略不同,该技能专门针对孕线形态——一种具有精确结构含义的双蜡烛形态:
- 1. 形态识别——孕线是传统技术分析中最可靠的反转形态之一,此处适配于Polymarket离散的5分钟间隔
- 坚定后的犹豫——大蜡烛显示强烈的方向性信念;随后接近50%的小蜡烛表明该信念已消散,形成结构性反转设置
- 确认门控——技能检查第三个间隔(确认蜡烛),仅当它尚未朝反转方向移动时才进行交易,确保优势未被市场定价
- 独立结算——每个5分钟间隔独立结算,因此孕线形态捕捉的是市场微观结构的真实转变,而非机械性的延续
信号逻辑
- 1. 通过关键词搜索发现加密货币间隔市场(Bitcoin Up or Down、Ethereum Up or Down、Solana Up or Down、XRP Up or Down),备选方案为getmarkets(limit=200)
- 使用正则表达式解析每个问题,提取(币种、日期、开始时间分钟)
- 按(币种、日期)分组间隔,并按时间排序
- 扫描每组,寻找连续配对,其中:
- 间隔N为
大:概率 < 0.40 或 > 0.60(与0.5的距离超过HARAMI_LARGE)
- 间隔N+1为
小:概率介于0.48和0.52之间(与0.5的距离在HARAMI_SMALL范围内)
- 5. 确定孕线方向:
-
看涨孕线:大跌(p < 0.40)后跟小中性 -> 预期反转上涨
-
看跌孕线:大涨(p > 0.60)后跟小中性 -> 预期反转下跌
- 6. 检查间隔N+2(确认):仅当它尚未朝反转方向移动时才进行交易
- 根据信念度(与阈值的距离)而非固定金额确定仓位大小
信号改造思路
- - 成交量加权孕线——通过交易量加权形态检测;高成交量的大蜡烛后跟低成交量的小蜡烛产生更强的反转信号
- 多时间框架确认——检查孕线形态是否与15分钟或小时聚合间隔的更广泛趋势反转一致
- 跨币种孕线——如果BTC出现孕线且ETH/SOL同时显示相同形态,则反转信号更强(相关性衰竭)
- 十字星优化——区分小蜡烛恰好为50%(十字星)与略有偏差的孕线;真正的十字星孕线具有更高的反转率
- 吞没跟进——在孕线反转后,寻找同一方向的吞没形态以加仓
安全与执行模式
该技能默认为模拟交易(venue=sim)。仅当使用--live标志时才进行真实交易。
| 场景 | 模式 | 财务风险 |
|---|
| python trader.py | 模拟(sim) | 无 |
| 定时任务/自动化程序 |
模拟(sim) | 无 |
| python trader.py --live | 实盘(polymarket) | 真实USDC |
autostart: false和cron: null意味着在Simmer UI中配置之前,不会自动运行任何内容。
所需凭证
| 变量 | 必需 | 说明 |
|---|
| SIMMERAPIKEY | 是 | 交易授权。请视为高价值凭证妥善保管。 |
可调参数(风险参数)
所有参数均在clawhub.json中声明为tunables,并可在Simmer UI中调整。
| 变量 | 默认值 | 用途 |
|---|
| SIMMERMAXPOSITION | 40 | 完全信念度下每笔交易的最大USDC |
| SIMMERMINTRADE |
5 | 任何交易的最低金额(无论信念度如何的最小USDC) |
| SIMMER
MINVOLUME | 3000 | 最低市场成交量过滤器(美元) |
| SIMMER
MAXSPREAD | 0.10 | 最大买卖价差 |
| SIMMER
MINDAYS | 1 | 距结算的最短天数 |
| SIMMER
MAXPOSITIONS | 10 | 最大同时持仓数量 |
| SIMMER
YESTHRESHOLD | 0.38 | 仅当市场概率 <= 此值时买入YES |
| SIMMER
NOTHRESHOLD | 0.62 | 仅当市场概率 >= 此值时卖出NO |
| SIMMER
HARAMILARGE | 0.10 | 大蜡烛与0.5的最小距离 |
| SIMMER
HARAMISMALL | 0.02 | 小蜡烛与0.5的最大距离 |
优势理论
Polymarket上的加密货币5分钟间隔市场表现出经典的蜡烛图反转形态。当一个强劲的方向性间隔(远离50%)之后紧跟着一个中性间隔(接近50%)时,这种孕线形态表明方向性信念已经消散。小蜡烛代表强劲走势后的市场犹豫不决——这是传统和加密货币技术分析中众所周知的反转前兆。该技能通过在确认间隔以反转方向进行交易来利用这一点,并根据与交易阈值的距离采用基于信念度的仓位调整。
依赖项
simmer-sdk by Simmer Markets (SpartanLabsXyz)
- - PyPI: https://pypi.org/project/simmer-sdk/
- GitHub: https://github.com/SpartanLabsXyz/simmer-sdk