
Market Microstructure
Market microstructure: bid-ask spread analysis, order-flow toxicity metrics (VPIN /...
Install
npx skills add HKUDS/Vibe-Trading --skill market-microstructure -g -a claude-code -y- Repository
- HKUDS/Vibe-Trading37.4k
- Category
- Engineering
- Updated
- 3d ago
- License
- MIT
- Context cost
- Mediumabout 3,000 tokens
- Runs scripts
- No, instructions only
What it does
Market microstructure: bid-ask spread analysis, order-flow toxicity metrics (VPIN / Kyle lambda), liquidity measures (Amihud / Roll), price-impact models, limit-order-book analysis, and China A-share call auction / block trade mechanics.
Market Microstructure
Overview
Study the micro-level mechanisms of price formation: who is trading, how they are trading, and how trades affect prices. For quantitative strategies, this matters because it improves transaction-cost estimation, identifies informed trading, and optimizes execution.
Applicable scenarios:
- Precise estimation of strategy trading costs (instead of simply assuming a flat 0.1% fee)
- Designing large-order execution strategies (
TWAP / VWAP / IS) - Detecting order-flow toxicity (avoid time windows dominated by informed traders)
- Quantifying liquidity risk (flash-crash warning)
- Capturing China A-share-specific microstructure features (call auction / closing auction / block trades)
Core Concepts
Bid-Ask Spread
Three measurements:
| Metric | Formula | Meaning |
|---|---|---|
| Quoted spread | Ask - Bid | Best spread shown in the limit order book |
| Effective spread | `2 × | trade price - mid price |
| Realized spread | 2 × direction × (trade price - mid price 5min later) | True market-maker profit |
China A-share example:
Instrument: 600519.SH Kweichow Moutai
Best bid: 1680.00 Best ask: 1680.50
Quoted spread: 0.50 RMB = 0.03%
Instrument: 000001.SZ Ping An Bank
Best bid: 11.05 Best ask: 11.06
Quoted spread: 0.01 RMB = 0.09%
Spread decomposition (Roll):
Spread = adverse-selection cost + inventory cost + order-processing cost
In China A-shares: adverse selection accounts for 60-70% (mixture of retail and informed traders)
Spread drivers:
- Larger market cap -> smaller spread (Moutai 0.03% vs small-cap 0.5%)
- Higher volatility -> wider spread (market-maker risk premium)
- Higher volume -> narrower spread (greater competition)
- Higher information asymmetry -> wider spread (adverse selection)
