Mean reversion
HyperliquidRangingPerpetuals (leverage/short)Medium riskz-score buys dips below mean, exits on reversion
Track record
Return
+3.7%
Sharpe
1.72
Max DD
1.3%
AUM
$0
Created
2026-06-13
Investors
0
Pools
0
Settled days
0
Market fit
RangingSideways, mean-reverting price action- ✓Buys low / sells high while price oscillates around a mean
- ⚠Averaging against a strong one-way trend can draw down hard
Backtest (deterministic simulator)
Parameters: window / k / sizeBacktest curve is an example on a deterministic simulated price path — not real returns.
Core source
Source on GitHub ↗"""均值回归(Mean reversion)—— 布林带 / z-score。
思路:价格相对滚动均值显著偏低(z-score ≤ -k)时买入,回到均值(z-score ≥ 0)时离场。适合震荡、
无趋势的行情;趋势行情会连续亏损,需配合风控(max_position / 止损,本 demo 用仓位上限)。
参数:window(均值窗口)、k(进场偏离倍数)、size(目标数量)。
"""
from __future__ import annotations
from ..base import StrategyBase
from ..context import StrategyContext
from ..indicators import zscore
from ..registry import register
@register("均值回归")
class MeanReversion(StrategyBase):
description = "z-score 偏离均值买入、回归离场(震荡行情)。"
params = {"window": 20, "k": 1.0, "size": 5.0}
def __init__(self, window: int = 20, k: float = 1.0, size: float = 5.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()
hist = await ctx.history(sym, self.window + 1)
z = zscore(hist, self.window)
if z is None:
return
if z <= -self.k:
await ctx.target(sym, self.size, band=self.size * 0.1) # cheap vs mean → accumulate
elif z >= 0:
await ctx.target(sym, 0.0, band=self.size * 0.1) # reverted → exit
The full SDK and all strategies are MIT-licensed open source — backtest, paper-trade, or fork them directly.
Pools running this strategy
No pools are running this strategy yet — be the first to launch one.