战绩
收益
+15.4%
夏普
1.84
最大回撤
4.8%
管理规模
$0
创建时间
2026-07-12
使用人次
0
使用池子
0
结算天数
0
回测(确定性模拟器)
参数: window / k / size二元预测市场模拟(YES/NO,240 步后结算 YES)——非未来收益承诺。
核心代码
GitHub 源码 ↗"""概率均值回归(Probability mean-reversion)—— logit 空间的 z-score 反向下注。
思路:事件概率(YES 价格)常在短期过度反应。把 YES 价格映射到 logit(log-odds)空间计算滚动 z-score:
概率被显著高估(z ≥ +k)时买入 NO(等价于看空 YES,因 token 不能做空)、被显著低估(z ≤ -k)时买入
YES,回归(|z| 收敛)后两腿平仓。临近结算的窗口内停止加仓——此时结算跳变主导,均值回归假设失效。
适用性:instrument="event"、venues=["POLYMARKET"]。做空由"买对侧 token"实现。
"""
from __future__ import annotations
from ..base import StrategyBase
from ..context import StrategyContext
from ..indicators import logit, zscore
from ..registry import register
@register("概率均值回归")
class PmProbMeanRev(StrategyBase):
description = "事件概率在 logit 空间偏离滚动均值时反向下注(高估买 NO、低估买 YES),回归平仓。"
params = {"window": 30, "k": 1.2, "size": 15.0}
venues = ["POLYMARKET"]
symbols: list = []
instrument = "event"
def __init__(self, window: int = 30, k: float = 1.2, size: float = 15.0) -> None:
self.window = int(window)
self.k = float(k)
self.size = float(size)
async def on_tick(self, ctx: StrategyContext) -> None:
sym = ctx.conn_symbol()
no = ctx.complement_token(sym)
hist = await ctx.history(sym, self.window + 1)
if len(hist) < self.window:
return
z = zscore([logit(p) for p in hist], self.window)
if z is None:
return
band = self.size * 0.15
# 临近结算:停止均值回归,平掉两腿(结算跳变主导)
ttr = ctx.time_to_resolution()
if ttr is not None and ttr < self.window:
await ctx.target(sym, 0.0, band=band)
if no is not None:
await ctx.target(no, 0.0, band=band)
return
if z >= self.k: # 概率高估 → 买 NO 看空
await ctx.target(sym, 0.0, band=band)
if no is not None:
await ctx.target(no, self.size, band=band)
elif z <= -self.k: # 概率低估 → 买 YES
if no is not None:
await ctx.target(no, 0.0, band=band)
await ctx.target(sym, self.size, band=band)
elif abs(z) < 0.3: # 回归 → 平两腿
await ctx.target(sym, 0.0, band=band)
if no is not None:
await ctx.target(no, 0.0, band=band)
完整 SDK 与全部策略以 MIT 协议开源,可直接回测、paper 试跑或二次开发。
运行此策略的池子
暂无池子运行此策略——成为第一个发起者。