5D Library › High-Frequency Limit Order Book Microstructure, Hawkes Self-Exciting Point Processes and Adverse-Selection Flow Toxicity · 中文
Preface: Spreads, Clusters and Toxic Flow
Note
Risk notice: please read this first. This book presents mathematical models for teaching and research. It is not investment, trading, career, tax or legal advice. Backtests and simulations do not represent future returns; every price, order, volume figure and trading day in the book is fictional or simulated, not data from any real market, exchange or security. The book recommends no particular asset, exchange, currency or broker, and offers no method that “guarantees”, “always wins”, “cannot lose” or is “proven optimal”. Its models hold only under the assumptions stated; real markets can violate them at any time. Market making and high-frequency trading carry technical, regulatory and liquidity risks, and leverage and derivatives can lose everything invested and more.
A market maker posts a bid and an ask at the same time and earns the difference; but some of the people who hit her quotes know more than she does. The faster the fills come, and the more they pile up on one side, the more she has to wonder: is this ordinary buying and selling, or is someone picking her off? Orders seem to arrive in clusters, a large order followed by more in the same direction; when more is queued on the bid than on the ask, the price seems more likely to tick up; an institution that must sell a large block moves the price if it sells too fast and carries price risk if it sells too slowly. This book asks which of these intuitions are supported by mathematics and evidence, which need qualifying, and which are wrong.
Answering takes four layers of tools. The first is information: why the bid–ask spread exists and how prices absorb private information through trading. The second is inventory: how a risk-averse market maker should move her quotes according to what she holds. The third is arrivals: why orders arrive in clusters, and how clustering produces noise and spurious correlation patterns in high-frequency data. The fourth is measurement and execution: whether “toxicity” can be measured from trade data, what an imbalanced book says, and how a large order should be split.
What the book covers
Chapter 1 covers the sequential-trade model of Glosten and Milgrom and Kyle’s sequential and continuous auctions; Chapter 2 the Avellaneda–Stoikov market-making equations, compared with the exact solution of Guéant, Lehalle and Fernandez-Tapia; Chapter 3 self- and mutually exciting Hawkes processes, the stationarity condition, the signature plot and the Epps effect; Chapter 4 the probability of informed trading (PIN), the volume-synchronised probability of informed trading (VPIN) and the dispute over the flash crash of 6 May 2010; Chapter 5 order flow imbalance (OFI), queue imbalance and queue position; Chapter 6 Almgren–Chriss optimal execution and its relation to TWAP and VWAP; Chapter 7 reads these beside the market officers of the Rites of Zhou, the “conspicuous mound” of the Mencius and the market-exchange law recorded in the History of Song; and Chapter 8 offers a four-step checklist and a pre-registered simulated-matching experiment.
The book neighbours several others in 5D Library; where they overlap, it only recaps briefly, cites the earlier book and does not repeat its programs. Book 19, Non-Ergodic Wealth Dynamics, the Kelly Criterion and Volatility Drag, treated position sizing and time-average growth. Book 20, Credit Cycles, Self-Organised Criticality and the Statistical Physics of Market Phase Transitions, treated liquidity spirals and criticality. Book 32, Algorithmic Game Theory, Braess’s Paradox and the Price of Anarchy in Traffic and Attention Networks, treated mechanism design and the efficiency loss of equilibria (Chapter 7’s middleman model borrows only that viewpoint). Book 33, Scientific Methodology, Falsifiability and the Mathematical Statistics of the Replication Crisis, treated pre-registration, power and decision rules (Chapter 8 follows it). Book 38, Implied Volatility Surfaces, Skew Premia and Quantitative Risk Control of Vertical Spreads, treated options and the variance risk premium and showed that maximum drawdown has almost no statistical power (Chapter 8 only recaps). Book 39, Liquidation Cascades, Order-Book Depth Depletion and Cointegrated Statistical Arbitrage, derived the price-impact coefficient of the one-period Kyle model and treated the square-root impact law, Ogata thinning and maximum-likelihood estimation of Hawkes processes, and the dispute over “a branching ratio of about 0.92, markets near criticality” (Chapters 1, 3 and 6 only recap). Book 40, Macro-Liquidity Regime Switching, Extreme Tail Dependence and Barbell Asset Allocation, treated tail risk and liquidity regimes; this book’s risk notice, disclosure and Chapter 8 follow its pattern.
Claims corrected after checking
Several points in the author’s framework needed correcting, supplementing or qualifying after checking. Each chapter says so where it arises, and the accompanying editorial notes list them together.
- “Grossman–Milgrom”. The 1985 Journal of Financial Economics paper on the sequential-trade model is by Lawrence Glosten and Paul Milgrom (Glosten and Milgrom 1985); Sanford Grossman is a co-author (with Stiglitz, 1980) of another classic, “On the impossibility of informationally efficient markets” (Grossman and Stiglitz 1980). The Chinese transliteration is corrected accordingly. Further, the Glosten–Milgrom model is a sequential-trade model (a dealer quoting trade by trade); “sequential auctions” and “continuous auctions” are the two settings of Kyle (1985) (Kyle 1985) (Chapter 1).
- Kyle’s λ. In the single auction the price-impact coefficient is (derived in Book 39); in the continuous auction it is , twice as large, the insider’s expected profit doubles from to , and all private information is in the price by the end of trading. The program iterates the difference equations of Kyle’s Theorem 2: with 1,024 auctions λ is 0.9963 and the profit 0.9960 (limit 1) (Chapter 1).
- The Avellaneda–Stoikov formulas. The reservation price and the total spread agree with the paper (Avellaneda and Stoikov 2008), but the latter rests on exponential arrival intensities , an expansion of the value function in inventory and a first-order (linear) approximation of the order-arrival term; it is not the exact optimum. Guéant and co-authors reduced the problem to a linear system of ordinary differential equations and solved it exactly with bounded inventory (Guéant et al. 2013): away from the horizon the optimal quotes hardly depend on time, whereas the approximation grows linearly with time remaining. With Avellaneda and Stoikov’s own simulation parameters and one unit of time remaining, the reservation-price shift for an inventory of 1 is −0.400 by the approximation and only −0.052 exactly; with risk aversion γ = 1 the approximation’s mean spread is 3.03 against 1.21 for the exact solution, and mean profit per session 31.2 against 63.9. “Derives the optimal quotes” should therefore read “derives an approximation that is accurate as approaches and less accurate the further away the horizon is” (Chapter 2).
- Hawkes processes and the Epps effect. The conditional intensity and the stationarity condition are correct (Hawkes 1971); but the Epps effect is an empirical phenomenon, the fall of correlations between assets at high sampling frequencies (Epps 1979), and mutually exciting Hawkes processes are one model that explains it (Bacry et al. 2013); asynchronous trading is another, and each can produce it on its own. The program shows that the bias caused purely by asynchronous observation is removed by the Hayashi–Yoshida estimator (Hayashi and Yoshida 2005). “A branching ratio near 1” is only recapped from Book 39, without a verdict (Chapter 3).
- VPIN and the flash crash. “VPIN rose before the flash crash and liquidity providers withdrew because of adverse selection” is the interpretation of Easley, López de Prado and O’Hara (Easley et al. 2011, 2012). Andersen and Bondarenko found that VPIN is a poor predictor of short-run volatility, that it peaked after the crash and that its predictive power comes mainly from a mechanical relation with trading intensity (Andersen and Bondarenko 2014b); the original authors replied (Easley et al. 2014), and Andersen and Bondarenko answered that reply, adding that the results depend heavily on the trade-classification method (Andersen and Bondarenko 2014a). The joint report of the US Commodity Futures Trading Commission and Securities and Exchange Commission traced the start of that afternoon to a sell program of about 75,000 E-mini contracts (U.S. Commodity Futures Trading Commission and U.S. Securities and Exchange Commission 2010); Kirilenko and co-authors found that high-frequency traders did not change their trading behaviour as prices fell (Kirilenko et al. 2017). The book presents “adverse-selection withdrawal” as a disputed mechanism, not an established cause (Chapter 4).
- “Order book imbalance” and CKS 2014. Cont, Kukanov and Stoikov (2014) studied order flow imbalance (OFI, the sum of signed changes in the quantities at the best bid and ask), which is close to linear in mid-price changes over the same interval: an average of 65 % for 50 US stocks in April 2010, with a slope roughly inversely proportional to depth (Cont et al. 2014). It is not the static imbalance of queued quantities. The static queue imbalance is related to the direction of the next price move non-linearly, and the relation depends on the absolute sizes of the two queues, not just on their ratio (Cont and Larrard 2013; Gould and Bonart 2015) (Chapter 5).
- Almgren–Chriss and iceberg orders. The hyperbolic-sine optimal trajectory holds only with linear impact, arithmetic Brownian motion and a mean–variance criterion (Almgren and Chriss 2001); iceberg orders (limit orders that display only part of their size) are a separate question, not part of the Almgren–Chriss model, and the book treats them separately. VWAP is not on the efficient frontier when impact is constant: in the program its expected cost is 5.3 % above TWAP’s; VWAP is the risk-neutral optimum only when temporary impact is inversely proportional to the volume of each period (Chapter 6).
- The classical texts. The “Rites of Zhou” passage on the market director, “以次叙分地而经市,以陈肆辨物而平市,以政令禁物靡而均市”, checks out (孙诒让 撰,王文锦、陈玉霞 点校 1987). The Mencius passage reads “古之为市也,以其所有易其所无者,有司者治之耳”; the author’s framework has “古之为市者”, corrected to the received text (焦循 撰,沈文倬 点校 1987). The author mentioned “records in Shen Kuo’s Dream Pool Essays of brokers (yaren) or the market-exchange office quoting and matching prices”: this round of checking found no entry in the Dream Pool Essays describing brokers or the market-exchange office “quoting and matching”, so the book does not cite it; it uses instead what can be verified in the “Market Exchange” section of the “Treatise on Food and Money” in the History of Song (Wei Jizong’s proposal of an “ever-normal market-exchange office”, the Secretariat’s establishment of the Market Exchange Bureau, and the criticism that it “used the government to monopolise”) (脱脱 等 撰 1977). “Quoting and matching” is modern vocabulary: the bureau was a state agency that bought, sold and lent against collateral, not a matching engine (Chapter 7).
- Chapter 8’s outcomes. The author’s framework proposed comparing two outcomes, “the Sharpe ratio of terminal net value and the maximum inventory drawdown”. A pre-registered protocol can have only one primary outcome; the book chooses the difference in Sharpe ratios and makes maximum inventory and drawdown secondary outcomes, for reasons given in Chapter 8. The sampling distribution of the Sharpe ratio has known biases and non-normality (Lo 2002), so the standard error is computed by a paired bootstrap, with the normal-theory formula as a cross-check (Jobson and Korkie 1981; Memmel 2003; Ledoit and Wolf 2008) (Chapter 8).
How to read the boxes
As in the other books of 5D Library, different kinds of statement are marked separately.
Evidence
Evidence boxes report published research findings, with sources.
Calculation
Calculation boxes give short Python programs. Each runs unchanged in a standard Python 3 environment, uses only the standard library and fixes its random seed; its actual output is printed below it. All prices, orders, volumes and trading days in the book are fictional or synthetic, and parameters are illustrative, not estimates for any real market or security.
Hypothesis · not established
Hypothesis boxes contain the author’s ideas, marked “not established”, together with the result that would show them wrong. The author’s own models and definitions are labelled “the author’s model” in the text.
Source text
Source boxes quote ancient texts with a plain-language rendering.
Note
Note boxes give reminders and explain choices.
About this edition
This is version 1.0.0, the first complete edition: a preface and eight chapters, in Chinese and English. It contains 16 Python programs and 5 vector figures. The text, boxes and code were drafted with an AI writing tool from the author’s title, framework and notes; the author is responsible for reviewing and revising them and for checking sources. AI-drafted text can get bibliographic details wrong; corrections are welcome through the 5D Library website. The spread-decomposition model of Chapter 4, the queue-position model of Chapter 5, the middleman model of Chapter 7 and the pilot environment of Chapter 8 are the author’s models; their mathematical properties are not evidence of predictions about any real market.
Disclosure
The author uses the works of 5D Library, including this book, as the methodological basis of his community courses, the 5D Ascension Cards (Dimensional Shift Card Decks) and the Yafu AI knowledge base, and therefore has a commercial interest in the subject of this book. The book promotes no course, card deck or service; the Chapter 8 trial is designed to be run and analysed by researchers independent of the author’s business and does not recruit from the author’s community, students or customers; all the code and the study protocol are published openly for anyone to check. The author develops and maintains quantitative research scripts and provides related open-source research and independent consulting services; while writing this book he may have held routine observation positions in US equity index funds (such as SPY) or related derivatives. All models in this book are offered solely for mathematical and historical-statistical discussion; they constitute no investment advice or trading signal, and the book recommends no specific trade or asset.
References
Fan, Y. (2026). High-Frequency Limit Order Book Microstructure, Hawkes Self-Exciting Point Processes and Adverse-Selection Flow Toxicity: From the Avellaneda–Stoikov Market-Making Equations to VPIN, Read Beside Classical Chinese Thought on Market Equilibrium [高频限价订单簿微观结构、霍克斯自激点过程与逆向选择毒流] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.23828065 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).