market-microstructure
यह क्या करती है
यह स्किल ट्रेडिंग स्क्रीन पर कीमतें कैसे बनती हैं, यह समझाती है, जिसमें स्प्रेड, ऑर्डर फ़्लो और लिक्विडिटी शामिल हैं। यह उन ट्रेडरों के लिए है जो ट्रेडिंग लागत घटाना या बड़े ऑर्डर का समय सही रखना चाहते हैं।
कब इस्तेमाल करें
- ✓जब आप ट्रेडिंग लागत का यथार्थवादी अनुमान चाहें, सपाट फ़ीस के बजाय।
- ✓जब आप बड़ी पोज़िशन खरीदने या बेचने की योजना बना रहे हों और उसका कीमत पर असर सीमित करना चाहें।
- ✓जब आप जाँचना चाहें कि आपकी रणनीति के लिए कोई शेयर पर्याप्त लिक्विड है या नहीं।
Skill का लिंक
https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/market-microstructure/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“इस शेयर के 50,000 शेयर बिना कीमत हिलाए खरीदने में मुझे असल में कितना खर्च आएगा?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह खरीद और बिक्री कीमतों के बीच का अंतर और ट्रेड कीमतों को कैसे धकेलते हैं, यह मापती है। ऑर्डर का आकार और समय तय करने के लिए यह लिक्विडिटी माप और ऑर्डर बुक डेटा भी इस्तेमाल करती है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
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)
Order-Flow Toxicity Metrics
VPIN (Volume-Synchronized Probability of Informed Trading):
Principle: replace clock time with volume time to measure the probability of informed trading
Calculation steps:
1. Bucket trades by fixed volume (Volume Bucket)
Bucket size V = average daily volume / 50 (about 5-10 minutes per bucket)
2. Classify buy and sell volume in each bucket (Bulk Volume Classification):
buy_volume = V × Φ(ΔP / σ) (standard normal CDF)
sell_volume = V - buy_volume
3. Compute order-flow imbalance:
OI_i = |buy_volume_i - sell_volume_i|
4. VPIN = Σ(OI_i) / (n × V) (n=50-bucket rolling window)
Interpretation:
VPIN < 0.3 -> normal, low informed-trading share
VPIN 0.3-0.5 -> caution, informed trading rising
VPIN > 0.5 -> dangerous, high probability that major information is about to be released
China A-share usage:
A sudden VPIN spike in a stock may foreshadow:
- insider trading ahead of a major announcement
- institutional position building / distribution
Before the 2015 China A-share flash crashes, VPIN stayed above 0.6 for a prolonged period
Kyle's Lambda (price impact coefficient):
Model: ΔP = λ × OrderFlow + ε
where OrderFlow = buy volume - sell volume
Estimation method:
1. Compute ΔP and OrderFlow in 5-minute windows
2. Regress ΔP = α + λ × OrderFlow
3. λ = price change caused by one unit of order flow
Interpretation:
Large λ -> poor liquidity, high impact
Small λ -> good liquidity, large orders can be executed cheaply
Typical China A-share values:
Large cap (CSI 300): λ ≈ 0.001-0.005
Mid cap (CSI 500): λ ≈ 0.005-0.02
Small cap (CSI 1000): λ ≈ 0.02-0.1
Liquidity Measures
| Metric | Formula | Advantages | Disadvantages |
|---|---|---|---|
| Amihud illiquidity | ` | R_t | / Volume_t` |
| Roll implied spread | 2√(-Cov(R_t, R_{t-1})) |
Requires only daily data | Fails when covariance is positive |
| LOT zero-return ratio | zero-return days / total days | Intuitive | Too coarse |
| Turnover ratio | volume / free float | Simple and intuitive | Does not reflect price impact |
| Traded value | average daily notional | Absolute liquidity | Does not reflect relative impact |
Amihud calculation (China A-shares):
ILLIQ = (1/D) × Σ(|R_d| / VOL_d) (D=trading days, monthly)
Normalization: ILLIQ × 10^6 (for readability)
Screening rules:
ILLIQ < 0.5 -> high liquidity (large-cap blue chips)
ILLIQ 0.5-5 -> medium liquidity
ILLIQ > 5 -> low liquidity (trade cautiously)
Strategy application:
- Liquidity
अक्सर पूछे जाने वाले सवाल
बिड-आस्क स्प्रेड क्या है?
खरीदारों की सबसे ऊँची पेश की गई कीमत और विक्रेताओं की सबसे नीची माँगी गई कीमत के बीच का अंतर।
क्या यह चीन के A-शेयर कवर करती है?
हाँ। इसमें चीन के A-शेयर कॉल ऑक्शन, क्लोजिंग ऑक्शन और ब्लॉक ट्रेड शामिल हैं।
VPIN क्या है?
VPIN ऑर्डर फ़्लो की विषाक्तता का माप है, जो दिखाता है कि कितना ट्रेडिंग जानकार ट्रेडरों से आ सकता है।
जानकारी
लेखक का मूल विवरण
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.
repo: HKUDS/Vibe-Trading
लोकप्रियता
- GitHub स्टार
- 37k
- रैंकिंग में स्थान
- #7531
- लाइसेंस
- MIT
- अपडेट की गई
- 1/11/2026
कमेंट
- …
इस repository की और skills
vibe-trading
37kयह आपके एजेंट को वित्त शोध का पूरा टूलकिट देती है, जिसमें बैकटेस्ट, फ़ैक्टर एनालिसिस, ऑप्शन प्राइसिंग और कई बाज़ारों का डेटा शामिल है।
adr-hshare
37kयह आपके एजेंट को दिखाती है कि कई बाज़ारों में लिस्टेड एक चीनी कंपनी के भाव की तुलना कैसे करें, जैसे अमेरिकी ADR और हॉन्गकॉन्ग शेयर।
akshare
37kयह आपके एजेंट को चीनी और वैश्विक शेयरों, फ़्यूचर्स, फ़ॉरेक्स और आर्थिक संकेतकों का मुफ़्त बाज़ार डेटा लेने देती है, बिना API key के।
alpha-zoo
37kयह आपके एजेंट को बने-बनाए स्टॉक फ़ैक्टरों की लाइब्रेरी देखने और चुने हुए बाज़ार पर उनके पूरे समूह के रिटर्न की भविष्यवाणी की क्षमता जाँचने देती है।
मिलती-जुलती skills
gitcrawl
394kयह आपके एजेंट को GitHub issues और pull requests के सेव आर्काइव में खोजने, मिलते-जुलते मामलों को समूह में रखने और लाइव स्थिति जांचने देती है।
slacrawl
394kयह आपके एजेंट को स्थानीय Slack आर्काइव में संदेश खोजने और गिनने, उसकी ताज़गी जांचने और ज़रूरत पड़ने पर उसे ताज़ा करने देती है।
goplaces
394kयह आपके एजेंट को Google Places से जगहें खोजने, उनका विवरण और समीक्षाएं पाने, और जगह के नाम हल करने में मदद करती है, स्क्रिप्ट के लिए JSON आउटपुट के साथ।