Overview
TheMarketMakerStrategy provides a complete market-making implementation with:
- Automated quote generation and management
- Inventory-based price skewing
- Position limits and risk controls
- Multi-level quoting support
MarketMakerConfig
Configure your market-making strategy withMarketMakerConfig:
nano-strategy/src/market_maker.rs:12-32
Default Configuration
nano-strategy/src/market_maker.rs:34-48
Creating a Market Maker
Inventory Skewing
The market maker automatically adjusts quote prices based on inventory to reduce risk:nano-strategy/src/market_maker.rs:196-222
How Inventory Skewing Works
-
Neutral Position (inventory = 0)
- Quotes are symmetric around mid price
- Bid: mid - half_spread
- Ask: mid + half_spread
-
Long Position (inventory > 0)
- Bid is lowered (less aggressive buying)
- Ask is lowered (more aggressive selling)
- Encourages reducing inventory
-
Short Position (inventory < 0)
- Bid is raised (more aggressive buying)
- Ask is raised (less aggressive selling)
- Encourages covering short
Example
Quote Management
TheQuoteManager tracks all active orders:
nano-strategy/src/market_maker.rs:51-61
Key Methods
nano-strategy/src/market_maker.rs:63-164
Multi-Level Quoting
Generate quotes at multiple price levels:nano-strategy/src/market_maker.rs:254-322
Level Spacing
Withnum_levels = 3 and tick_size = 25:
Position Limits
The strategy respects position limits:nano-strategy/src/market_maker.rs:266-269
Quote Refreshing
Quotes are refreshed periodically:nano-strategy/src/market_maker.rs:224-227, 348-366
Canceling Stale Quotes
Orders too far from the best bid/offer are cancelled:nano-strategy/src/market_maker.rs:229-252
Complete Example
Monitoring
Access strategy state:Best Practices
-
Start with wider spreads - Use
base_spread_ticks >= 2to ensure profitability -
Tune inventory skewing - Adjust
inventory_skew_factorbased on market volatility:- Higher volatility → stronger skewing (0.7-1.0)
- Lower volatility → gentler skewing (0.3-0.5)
-
Set appropriate position limits - Don’t exceed your risk tolerance:
- Monitor fill rates - If fills are too low, tighten spreads or increase levels
-
Use appropriate refresh intervals - Balance between:
- Faster updates (50-100ms) for active markets
- Slower updates (200-500ms) for less liquid markets