Polymarket Valuation Divergence Trader
Trade markets where model probability diverges from Polymarket price.
This is a template. The default uses Simmer AI consensus as your probability model. Remix it with your own model, external APIs, or custom forecasting logic. The skill handles market scanning, Kelly sizing, and safe trade execution.
When to Use This Skill
Use this when:
- - You have a probability model (AI, statistical, fundamental analysis)
- You want to trade when market prices diverge from your model
- You need Kelly criterion sizing for risk management
- You want to catch structural mispricings (mergers, earnings, regulatory events)
Quick Start
Setup
- 1. Set your API key:
CODEBLOCK0
- 2. Check config:
CODEBLOCK1
- 3. Dry run (no trades):
CODEBLOCK2
- 4. Live trading:
CODEBLOCK3
Configuration
| Setting | Env Var | Default | Description |
|---|
| edgethreshold | INLINECODE0 | 0.015 | Min edge to trade (1.5%) |
| kellyfraction |
SIMMER_VALUATION_KELLY | 0.25 | Kelly criterion fraction (cap at 25%) |
| max
positionusd |
SIMMER_VALUATION_MAX_POSITION | 5.00 | Max per trade |
| max
tradesper_run |
SIMMER_VALUATION_MAX_TRADES | 5 | Max trades per cycle |
| probability
source | SIMMER_VALUATION_SOURCE | simmerai | "simmer
ai" or "usermodel" |
Update settings:
CODEBLOCK4
How It Works
1. Scan Markets
Fetches active markets from Simmer. For each:
2. Get Model Probability
Default: Simmer AI consensus from INLINECODE5
To use your own model: Edit get_model_probability() function.
3. Calculate Edge
CODEBLOCK5
If edge > threshold: trade signal ✓
4. Kelly Sizing
CODEBLOCK6
5. Execute Trade
- - If edge > 0: Buy YES (model thinks it's underpriced)
- If edge < 0: Buy NO (model thinks it's overpriced)
- Include reasoning for transparency
- Execute with safeguards (flip-flop detection, slippage warnings)
6. Hold to Resolution
Positions held until market resolves. Check --positions to see current holdings.
Interpreting the Output
CODEBLOCK7
Customizing Your Model
Edit get_model_probability() to use any source:
Option 1: User-provided probabilities (config)
CODEBLOCK8
Option 2: External API (e.g., Synth, Metaculus)
CODEBLOCK9
Option 3: Rules-based model
CODEBLOCK10
Commands
CODEBLOCK11
Risk Management
- - Position size cap:
max_position_usd limits each trade - Kelly fraction cap: Limited to 25% of bankroll (never bet >25% on one trade)
- Trade limit:
max_trades_per_run prevents over-trading - Safeguards: Simmer SDK checks for flip-flop warnings, slippage, expiring positions
- --no-safeguards: Skip checks (use only if you know what you're doing)
Troubleshooting
"No signals found"
- - Model probabilities and market prices are close
- Increase
edge_threshold in config if too conservative - Check your model source — is it generating probabilities?
"Markets scanned: 0"
- - No active markets available
- Try during peak market hours
"Edge is negative but we're buying YES"
- - This is correct! Edge < 0 means market is overpriced. Buy NO instead (which we do).
"Flip-flop warning: CAUTION"
- - You recently changed direction on this market
- Discipline tracking prevents over-trading. Wait or use
--no-safeguards.
Performance Metrics
Check your performance:
CODEBLOCK12
Shows: realized P&L, win rate, average edge per trade, largest positions.
When This Works Best
- 1. Structural mispricings: Merger arb, earnings surprises, regulatory news
- Consensus divergence: Market hasn't caught up to known information
- Model > crowd: Your probability model is better than crowd estimates
- Short-dated markets: Errors correct faster
When This Doesn't Work
- 1. Crowd is right: Market prices reflect true probabilities
- Model is calibrated wrong: Your probability estimates are worse than market
- Latency: By the time you execute, price moved against you
- Liquidity: Slippage eats the edge on illiquid markets
Start small. Test with dry-run first. Verify your model against historical outcomes. Then go live with small position sizes.
Polymarket 估值偏差交易者
交易模型概率与Polymarket价格存在偏差的市场。
这是一个模板。 默认使用Simmer AI共识作为你的概率模型。你可以用自有模型、外部API或自定义预测逻辑进行改造。该技能负责市场扫描、凯利公式仓位计算和安全交易执行。
何时使用此技能
在以下情况使用:
- - 你拥有概率模型(AI、统计、基本面分析)
- 当市场价格偏离你的模型时进行交易
- 需要凯利准则进行风险管理
- 希望捕捉结构性错误定价(并购、财报、监管事件)
快速开始
设置
- 1. 设置你的API密钥:
bash
export SIMMER
APIKEY=sk
live...
- 2. 检查配置:
bash
python valuation_trader.py --config
- 3. 模拟运行(不执行交易):
bash
python valuation_trader.py
- 4. 实盘交易:
bash
python valuation_trader.py --live
配置参数
| 设置项 | 环境变量 | 默认值 | 说明 |
|---|
| edgethreshold | SIMMERVALUATIONEDGE | 0.015 | 最小交易阈值(1.5%) |
| kellyfraction |
SIMMER
VALUATIONKELLY | 0.25 | 凯利准则分数(上限25%) |
| max
positionusd | SIMMER
VALUATIONMAX_POSITION | 5.00 | 每笔交易最大金额 |
| max
tradesper
run | SIMMERVALUATION
MAXTRADES | 5 | 每周期最大交易次数 |
| probability
source | SIMMERVALUATION
SOURCE | simmerai | simmer
ai 或 usermodel |
更新设置:
bash
python valuationtrader.py --set edgethreshold=0.02
工作原理
1. 扫描市场
从Simmer获取活跃市场。对每个市场:
2. 获取模型概率
默认:来自 /api/sdk/context/{market_id} 的 Simmer AI共识
要使用自有模型:编辑 getmodelprobability() 函数。
3. 计算偏差
偏差 = 模型概率 - 市场价格
如果 偏差 > 阈值:交易信号 ✓
4. 凯利仓位计算
凯利分数 = 偏差 / (1 - 市场价格)
凯利分数 = min(凯利分数, 最大凯利分数)
仓位大小 = 凯利分数 * 资金总额
仓位大小 = min(仓位大小, 最大交易金额)
5. 执行交易
- - 如果偏差 > 0: 买入YES(模型认为价格低估)
- 如果偏差 < 0: 买入NO(模型认为价格高估)
- 包含推理说明以提高透明度
- 带保护机制执行(反转检测、滑点警告)
6. 持有至结算
持仓持有至市场结算。使用 --positions 查看当前持仓。
输出解读
🎯 估值交易者扫描
扫描市场数:50
发现信号数:3
执行交易数:2
📰 BTC年底达到10万美元?
模型:65% | 市场:52% | 偏差:+13%
💰 买入YES $4.50(凯利:2.25股)
📰 特朗普会在2028年获胜吗?
模型:58% | 市场:71% | 偏差:-13%
💰 买入NO $3.75(凯利:2.05股)
自定义模型
编辑 getmodelprobability() 使用任何数据源:
选项1:用户提供的概率(配置)
python
def getmodelprobability(marketid, marketquestion):
# 从配置返回固定概率
return USERPROBABILITIES.get(marketid)
选项2:外部API(例如Synth、Metaculus)
python
def getmodelprobability(marketid, marketquestion):
# 从外部API获取预测
resp = fetchjson(f{EXTERNALAPI}/forecast?q={market_question})
return resp[probability]
选项3:基于规则的模型
python
def getmodelprobability(marketid, marketquestion):
if 加密货币 in market_question.lower():
return 0.55 # 加密货币历史上涨空间
elif 选举 in market_question.lower():
return 0.50 # 选举无强信号
return None # 无模型则跳过
命令
bash
模拟运行(模拟交易,不实际执行)
python valuation_trader.py
实盘交易
python valuation_trader.py --live
显示当前持仓
python valuation_trader.py --positions
显示配置
python valuation_trader.py --config
更新配置
python valuation
trader.py --set edgethreshold=0.02
静默模式(适合定时任务)
python valuation_trader.py --live --quiet
风险管理
- - 仓位上限: maxpositionusd 限制每笔交易
- 凯利分数上限: 限制为资金总额的25%(单笔交易不超过25%)
- 交易限制: maxtradesper_run 防止过度交易
- 保护机制: Simmer SDK检测反转警告、滑点、即将到期仓位
- --no-safeguards: 跳过检查(仅在明确风险时使用)
故障排除
未发现信号
- - 模型概率与市场价格接近
- 如过于保守,可在配置中增加 edge_threshold
- 检查模型数据源——是否生成了概率?
扫描市场数:0
偏差为负但我们在买入YES
- - 这是正确的!偏差 < 0 表示市场高估。应买入NO(我们正是这样做的)。
反转警告:注意
- - 你最近在该市场上改变了方向
- 纪律追踪防止过度交易。等待或使用 --no-safeguards。
绩效指标
检查你的表现:
bash
python valuation_trader.py --positions
显示:已实现盈亏、胜率、每笔交易平均偏差、最大持仓。
最佳适用场景
- 1. 结构性错误定价: 并购套利、财报意外、监管新闻
- 共识偏差: 市场尚未跟上已知信息
- 模型优于群体: 你的概率模型优于群体估计
- 短期市场: 错误纠正更快
不适用场景
- 1. 群体正确: 市场价格反映真实概率
- 模型校准错误: 你的概率估计劣于市场
- 延迟问题: 执行时价格已反向变动
- 流动性不足: 滑点侵蚀非流动性市场的偏差
从小开始。 先用模拟运行测试。用历史结果验证你的模型。然后以小额仓位进行实盘交易。