Sort order KYO hota hai? Exchange ko hamesha incoming party ke liye best available price pe trade karna hota hai. Isliye algorithm ko sirf har queue ke top ko dekhna padta hai — highest bid aur lowest ask. Sorting se O(1) peek guarantee hoti hai "best" prices pe.
Do fundamental order types hain, aur in dono ka difference samajhna microstructure ka 80% hai:
Size Q ka ek market buy KAISE execute hota hai ("the walk"):
Ye ask side ko upar se neeche eat karta hai. Pehle best ask ke against fill hota hai; agar us level ki depth khatam ho jaye, toh next-higher ask price pe move karta hai, aur aise tab tak chalta hai jab tak Q fill na ho jaye. Isliye bade orders ko worse average prices milti hain — wo "book mein walk up" karte hain. Note: har partial match sirf matched quantity ko ek resting order se remove karta hai; us level ki baaki depth wahan rahi rehti hai.
OBI direction KYO predict karta hai: Agar Vb≫Va, toh bahut saare buyers wait kar rahe hain lekin sellers kam hain — ek chhota sa market sell price ko zyada push nahi kar sakta, jabki ek market buy easily ask lift kar deta hai. Price upar drift karne lagti hai. OBI →+1 = buy pressure; OBI →−1 = sell pressure. Ye ek weak, fleeting predictor hai kyunki book har millisecond mein badlti hai.
Recall Feynman: ek 12-saal ke bachche ko explain karo
Socho ek lemonade stand market. Ek wall pe bacche likhte hain "Main ek cup ke liye 2dunga!"(highestpricetoppe).Doosriwallpesellerslikhtehain"Main2.10 mein bechunga!" (lowest top pe). Dono ke beech ka chhota sa gap ($0.10) spread hai. Agar ek pyaasa bachcha kehta hai "abhi lemonade do kisi bhi price pe," toh wo pehle sabse saste seller ko pakadta hai, phir usse agle saste ko, har cup ke liye thoda zyada pay karta hua — yahi walking the book hai. Agar ek seller ke paas 10 cups the lekin bachche ko sirf 4 chahiye the, toh sirf 4 cups bikenge aur baaki 6 wall pe likhe rahe. Agar bahut zyada buyers wait kar rahe hain sellers se zyada, toh prices jaldi upar creep karenge. Book bas sabki notes hai ki wo kya karenge, aur ye badlti rehti hai jab bacche apni notes add ya erase karte hain.
Ek continuously-updated, price-ranked record jo saare resting limit orders ka hota hai, bid side (highest price top pe) aur ask side (lowest price top pe) mein split.
Best bid aur best ask kya hote hain?
Best bid = highest price jo ek buyer pay karega; best ask = lowest price jo ek seller accept karega.
Maker ek resting limit order post karta hai (liquidity add karta hai); taker ek marketable/market order bhejta hai jo spread cross karke liquidity remove karta hai.
Bade market orders ko slippage kyun hoti hai?
Wo best level exhaust karte hain phir progressively worse price levels ke against execute karte hain ("walking the book"), average execution price ko best quote se upar le jaate hain.
Jab do orders match karte hain, book se kaunsi quantity remove hoti hai?
Sirf matched (overlapping) quantity = dono sizes mein se min; bade order ka koi bhi unfilled remainder resting rehta hai.
Book walk karne par average execution price ka formula?