> ## Documentation Index
> Fetch the complete documentation index at: https://docs.quantumvoid.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Perp Market Maker Strategy

> The XGrid family: high-frequency two-sided grid scalping with layered risk controls

# Perp Market Maker Strategy

## What It Does

**The Perp Market Maker is a high-frequency grid scalper that quotes both buy and sell orders around the current price, earns the spread between them, and follows momentum with tight take-profits.** In the **Marketplace tab** these presets appear under the **XGrid** family label.

In plain terms: the bot keeps limit buy orders just below the market and limit sell orders just above it, on multiple levels. When price wiggles inside that band, both sides fill and the difference — minus fees — is profit. It repeats this many times per day. The hard part is not the spread capture; it's surviving the moments when price *doesn't* wiggle but trends, leaving you holding inventory at a loss. Most of this strategy's machinery exists to detect, limit, and exit those moments.

```
         ASK $100.10 ← bot sells here
              │
    spread ───┼─── your gross profit per round trip
              │
         BID $100.00 ← bot buys here

Good case: price oscillates → both sides fill repeatedly.
Bad case:  price trends down → bids fill, asks don't → you accumulate
           a losing long. The loss tiers / time decay / counter-scalp
           below handle this case.
```

<Warning>
  This is the most configurable family (100+ parameters) and the current presets run **75x leverage**. Start from a Marketplace preset with small sizes; do not hand-roll a config until you can read this strategy's logs fluently.
</Warning>

***

## Core Concepts

### Equity-based sizing (`equity_pct`)

Modern presets size the quoting grid as a **percentage of account equity** rather than a fixed dollar amount:

```
Account: $1,000, equity_pct: 5  →  grid budget $50 per cycle
Account grows to $1,200         →  grid budget $60 per cycle
```

Positions scale with profits automatically — and shrink after losses. Current presets range from `equity_pct: 1.5` (MM Professional 2-Level on BloFin, the most conservative) to `10` (Minimalist Alpha on BloFin).

Combined with leverage this compounds fast: 5% equity at 75x leverage means a fully-deployed grid can represent several times your account in notional. Understand the math before raising it. The [Scaling Agent](/features/scaling-agent) can adjust it for you (`/set equity_pct 5`).

### Multilevel quoting

Instead of a single bid and ask, the bot quotes 2–6 levels per side (preset-dependent), sized and spaced so closer levels are filled first and deeper levels catch larger moves. Spacing is dynamic: presets widen quotes when volatility rises, when the order book thins, or as drawdown grows.

### Position limits

Every preset carries a hard ceiling (`max_position_usdt`, $500–$2,800 in current presets) that quoting will not exceed regardless of equity sizing.

***

## Risk Systems

### Tiered loss management

As an underwater position deepens, the bot steps through defensive tiers — widening spreads, cutting size, halting new entries, and finally force-closing. Tier thresholds are preset-specific. Two examples from current presets (values in basis points of loss):

|                        | Tier 1 | Tier 2 | Tier 3 | Hard stop  |
| ---------------------- | ------ | ------ | ------ | ---------- |
| **v7/v8 Counterscalp** | 100    | 500    | 800    | 1000 (10%) |
| **HFT v6**             | 100    | 300    | 600    | 1000 (10%) |

The hard stop is an emergency market exit with no exceptions.

### Time decay

Positions that age without reaching profit are progressively pushed toward the exit: take-profit targets shrink with age, then the bot accepts a small loss, then force-exits at market. Current preset values (v7 Counterscalp): accept a bounded loss exit after **8 hours**, breakeven push after **96 hours**, unconditional force exit after **48 hours**. The MM Professional presets allow up to 96 hours before force exit; HFT v6 forces out at 24 hours. `force_exit_enabled: false` disables the unconditional exit if you'd rather positions ride.

An **attack-to-exit** module can also actively work a stuck position out: after 30 minutes stuck, it adds small mean-reversion entries (capped at 1.25x the position) specifically to lower the breakeven and exit faster.

### XGrid counter scalp

When the main position is underwater and the [XGrid trend signal](/strategies/xgrid) confirms the move against you, the bot opens a counter-position (capped at 50% of the main) and scalps the adverse trend, offsetting part of the loss while the main position waits. Enabled in the v7/v8 Counterscalp and HFT v6 presets.

### Microstructure defenses

* **Whale detection** — finds large resting orders ("walls") and places quotes near them, so your orders sit behind real support/resistance
* **Trap detection** — exits fills whose immediate aftermath is toxic (price instantly moving against the fill)
* **Cascade detection** — recognizes liquidation cascades and stands aside instead of quoting into them
* **Reactive spacing** — widens quotes up to 10x when the order book thins or volatility spikes

***

## Current Marketplace Presets

All values below are read from the actual preset configs. Bybit/BloFin variants of the same preset are merged into one Marketplace card with an exchange toggle.

| Preset                                  | Levels | Sizing                            | Max position    | Leverage | Counter-scalp | Force exit |
| --------------------------------------- | ------ | --------------------------------- | --------------- | -------- | ------------- | ---------- |
| **MM Professional 2-Level**             | 2      | 1.5% equity (BloFin) / 3% (Bybit) | $2,000 / $2,800 | 75x      | off           | 96h        |
| **MM Professional** (5-level)           | 5      | 2% equity                         | \$2,000         | 75x      | off           | 96h        |
| **MM Minimalist Alpha**                 | 5      | 10% equity (BloFin) / 3% (Bybit)  | $2,000 / $2,800 | 75x      | Bybit only    | 48h        |
| **v7 Long Short Counterscalp**          | 4      | 5% equity                         | \$2,000         | 75x      | on            | 48h        |
| **v8 Long Short Counterscalp** (BloFin) | 4      | 5% equity                         | \$2,000         | 75x      | on            | 48h        |
| **HFT v6 Long Short MM**                | 6      | fixed $7–$10 quotes               | \$2,000         | 75x      | on            | 24h        |
| **ASTER Scalper MM** (BloFin)           | 5      | fixed \~\$11 quotes               | \$500           | 75x      | —             | 24h        |

Notes:

* **MM Professional 2-Level** is the suggested starting point for this family: only 2 quote levels, the lowest equity percentage, and professional sizing with inventory skew. Single- and multi-symbol variants exist on both exchanges.
* **v7 vs v8**: v8 raises take-profit targets to 9 bps (vs 6 bps on v7) for more profit per trade at the cost of fewer fills.
* **v7 spread settings** (both exchanges): 15 bps base spread, 8 bps floor, 50 bps ceiling, with reactive spacing widening up to 10x.
* **HFT v6** uses fixed quote sizes rather than equity scaling, with the tightest loss tiers and the fastest forced exit.

***

## Key Parameters

<ParamField path="proactive_multilevel.equity_pct" type="float" default="0">
  Grid budget as a percentage of account equity. `0` falls back to legacy fixed sizing. Presets: 1.5–10.
</ParamField>

<ParamField path="proactive_multilevel.levels" type="integer">
  Quote levels per side. Presets: 2–6.
</ParamField>

<ParamField path="position.max_position_usdt" type="float">
  Hard position ceiling in USDT. Presets: $500–$2,800.
</ParamField>

<ParamField path="position.leverage" type="integer">
  Leverage multiplier. All current presets: 75.
</ParamField>

<ParamField path="spread.base_spread_bps" type="integer" default="5">
  Base half-spread from mid in basis points (code default 5; counterscalp presets use 15, the professional/scalper presets 5).
</ParamField>

<ParamField path="loss_management.hard_stop_loss_bps" type="integer">
  Emergency exit threshold. All current presets: 1000 (10% of position).
</ParamField>

<ParamField path="time_decay.force_exit_after_seconds" type="integer">
  Unconditional market exit for aged positions. Presets: 24–96 hours. Gate with `force_exit_enabled`.
</ParamField>

<ParamField path="xgrid_counter_scalp.enabled" type="boolean" default="false">
  Counter-trend scalping against a stuck main position. See the [XGrid guide](/strategies/xgrid).
</ParamField>

***

## Risk Notes

<Warning>
  * **Leverage**: at 75x, a 1.33% adverse move equals 100% of position margin. The position ceiling and loss tiers bound this, but only if you don't override them.
  * **Trend risk**: market making profits in chop and bleeds in trends. The defensive stack reduces — not removes — trend losses.
  * **Counter-scalp risk**: counter positions lose money on sharp reversals while the main position recovers. The 50% cap bounds the damage.
  * **No performance promises**: spreads, tiers, and exits are configuration facts, not return estimates.
</Warning>

***

## Troubleshooting

### "Spread too tight, not quoting"

The market spread is below `min_profitable_spread_bps` (presets require \~11 bps over round-trip fees). Either the symbol is too tight to make markets on profitably, or wait for higher volatility.

### "Position stuck at a loss"

Check which loss tier you're in (the logs state it) — the bot may be intentionally in defend-only mode. Verify time decay is enabled; check whether counter-scalp is active and offsetting.

### "Orders keep getting cancelled and re-placed"

Reactive spacing repositions quotes as conditions change — normal. If you hit exchange rate limits, reduce quote levels.

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Preset Guide" icon="list-check" href="/strategies/preset-guide">
    Choose between the XGrid-family presets
  </Card>

  <Card title="XGrid Signal Engine" icon="bolt" href="/strategies/xgrid">
    The trend signal behind counter-scalp
  </Card>

  <Card title="Scaling Agent" icon="robot" href="/features/scaling-agent">
    Adjust equity\_pct and other settings conversationally
  </Card>

  <Card title="Risk Management" icon="shield" href="/risk-management/risk-management-best-practices">
    Sizing rules that keep you alive
  </Card>
</CardGroup>
