NovaMarket
← All strategies

Market making

HyperliquidRangingPerpetuals (leverage/short)Lower risk

inventory skew around mid: hold more when cheaper

Track record

Return
+3.0%
Sharpe
1.91
Max DD
0.5%
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
Not sure where the market is headed? Browse market-neutral strategies →

Backtest (deterministic simulator)

Parameters: ref_window / max_inventory / spread

Backtest curve is an example on a deterministic simulated price path — not real returns.

"""做市(Market making)—— 库存偏移(inventory-skew)。

思路:以滚动中间价为参考,价格越低于中间价就持有越多库存、越高就减仓——等价于围绕中间价的双边报价
在成交后把库存拉回中性,赚取价差/波动回归。本 demo 为长仓做市(库存 0..max);真实场馆可对称双边。
参数:ref_window(中间价窗口)、max_inventory(库存上限)、spread(价差敏感度)。
"""
from __future__ import annotations

from ..base import StrategyBase
from ..context import StrategyContext
from ..indicators import sma
from ..registry import register


@register("做市")
class MarketMaking(StrategyBase):
    description = "围绕中间价的库存偏移做市:越便宜持仓越多、越贵减仓。"
    params = {"ref_window": 20, "max_inventory": 6.0, "spread": 0.02}

    def __init__(self, ref_window: int = 20, max_inventory: float = 6.0, spread: float = 0.02) -> None:
        self.ref_window = int(ref_window)
        self.max_inventory = float(max_inventory)
        self.spread = float(spread)

    async def on_tick(self, ctx: StrategyContext) -> None:
        sym = ctx.conn_symbol()
        hist = await ctx.history(sym, self.ref_window + 1)
        mid = sma(hist, self.ref_window)
        if mid is None or mid == 0:
            return
        dev = (hist[-1] - mid) / mid  # >0 richer, <0 cheaper
        frac = max(0.0, min(1.0, -dev / self.spread))  # cheaper → larger inventory
        target = frac * self.max_inventory
        await ctx.target(sym, target, band=self.max_inventory * 0.08)

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.