Perpetual Market Maker Strategy
The Perp Market Maker is a sophisticated two-sided market making strategy that profits from bid-ask spreads while using advanced microstructure analysis to avoid adverse selection.How Market Making Works
The Basic Concept
Market makers provide liquidity by quoting both buy (bid) and sell (ask) prices. You profit from the spread between them:- You place BID at 100.10
- Someone sells to you at $100.00 (you now own the asset)
- Someone buys from you at $100.10 (you sell the asset)
- Net profit: $0.10 per unit (minus fees)
Why It’s Complex
The challenge: if price moves against you, you lose more than the spread profit.Core Configuration
Position Limits
Maximum position size in USDT. Hard ceiling - bot will not exceed this.
Size of each quote order in USDT.
Leverage multiplier. Higher = more capital efficiency but higher liquidation risk.
Equity-Based Sizing (New in v7)
The Growth Engine - Percentage of account equity to use for grid sizing.
0= Legacy behavior (uses base_size_pct)5.0= 5% of account equity per grid cycle10.0= 10% of account equity per grid cycle
- 5% equity_pct × 75x leverage = 375% effective exposure
- A 1% adverse move costs: 3.75% of your account
Fee Configuration
Maker fee in basis points. BloFin: 2 bps, Bybit: 2 bps
Taker fee in basis points. BloFin: 6 bps, Bybit: 5.5 bps
Minimum spread required to quote. Must cover round-trip fees + profit.
Spread Configuration
Base spread from mid-price in basis points.
Minimum allowed spread (floor).
Maximum allowed spread (ceiling).
How much to skew spread based on inventory. Higher = more aggressive rebalancing.
Loss Management Tiers
The bot uses a tiered loss management system that progressively reduces risk as losses accumulate:Configuration
Enable tiered loss management.
First tier threshold (1% loss).
Second tier threshold (3% loss).
Third tier threshold (6% loss).
Emergency exit threshold (10% loss). No exceptions.
Time Decay System
Positions that age without profit are progressively exited:Enable time-based exits.
Easy toggle for force exit. Set to
false to let positions run indefinitely.Exit at breakeven after this many seconds (48 hours).
Accept loss exit after this many seconds (8 hours).
Force market exit after this many seconds (24 hours).
Standard Time Decay Values (v7):
- Breakeven: 48 hours (172800 seconds)
- Exit Loss: 8 hours (28800 seconds)
- Force Exit: 48 hours (172800 seconds)
Advanced Detection Systems
Whale Detection
The bot detects large orders (“whale walls”) and positions near them for better fill probability:Enable whale wall detection.
Minimum wall size to consider (in USDT).
Trap Detection
Detects when you’re being “trapped” - adverse fills that immediately move against you:Enable trap detection.
Exit if fill toxicity exceeds this level.
Cascade Detection
Detects liquidation cascades (multiple forced liquidations causing rapid price movement):Enable cascade detection.
Geometric Multi-Level Quoting
Instead of single quotes, place multiple levels for better fill rates:Enable geometric multi-level quoting.
Size reduction per level.
0.92 = each level is 92% of previous.Maximum number of quote levels.
XGrid Counter Scalp
When the main position is underwater and XGrid detects an opposite trend, the bot can open a counter-position to scalp profits while waiting for recovery:Enable counter-trend scalping.
Maximum counter position as % of main position.
Main position must be this old before counter-scalping (5 min).
Preset Configurations
v7 Long Short Counterscalp (Recommended)
The latest preset with equity-based sizing and XGrid counter scalp:- BloFin v7
- Bybit v7
equity_pct: 5.0- Grids sized as 5% of account equityxgrid_counter_scalp: enabled- Automatic hedgingreactive_spacing.max_multiplier: 10- Wide spread range for volatilitytime_decay: 8h/8h/24h- Standard aging exits
HFT v6 (High Frequency)
Risk Management Best Practices
Position Sizing
Never risk more than 2% of your account on a single position.Formula:
max_position = account_balance * 0.02 / (leverage / 100)Example: 150 per positionExchange-Specific Notes
BloFin:- Maker fee: 2 bps, Taker fee: 6 bps
- Supports hedge mode
- Password required for API
- Maker fee: 2 bps, Taker fee: 5.5 bps
- Supports hedge mode
- Lower maximum leverage (50x vs 75x)
Troubleshooting
”Spread too tight, not quoting”
Yourmin_profitable_spread_bps is higher than current market spread.
- Solution: Lower
min_profitable_spread_bpsor trade during higher volatility
”Position stuck at loss”
- Check loss management tier - may be in defensive mode
- Enable time decay if not already
- Check if XGrid counter scalp can help offset losses
”Orders keep getting cancelled”
- Check exchange rate limits
- Reduce
geometric_max_levelsto place fewer orders - Increase quote refresh interval