QQuant, Built

Act VII · The System

Part 42 of 43

Machines in the Market

Master'sstarts at this level52 min of film 12 chaptersprerequisites: Part 8, Part 38

Two pricing algorithms that have never communicated settle on prices above the competitive level. Is that collusion?

Markets are increasingly populated by programs that learn. The part starts with artificial markets, where simple rules of imitation are enough to produce fat tails and volatility clusters with no news at all. Herding has an exact theory in Kirman's ants. Then learning agents: a market maker that learns to quote by trial and error, language models placed in a simulated market, and the experiment the title refers to, in which independent reinforcement learners arrive at supra-competitive prices and punish deviations. The part works out when such outcomes can persist and when they are an artefact of the learning rule. The last chapters ask what happens when everyone trains the same model.

What you need. Parts 8 and 38; AI, Built, Part 26, for reinforcement learning.

What you will be able to do

Undergraduate

  • Explain how imitation among traders can produce fat tails and volatility clusters.
  • Explain what algorithmic collusion means and why intent is hard to define.

Master's

  • Simulate a fundamentalist-chartist market and test it against the stylized facts of Part 1.
  • Train tabular Q-learners in a repeated pricing game and measure how far prices sit above the competitive level.

PhD

  • Derive the stationary law of Kirman's herding chain and its two regimes; prove when grim trigger sustains collusion and compare the bound with what the learners do.

Industry

  • Design a test for a trading agent that includes the market's reaction to it; state the regulatory questions about shared models.

Contents

Each chapter has a home level. Choose a track to see what to read and watch: Undergraduate 17 min · Master's 42 min · PhD 52 min · Industry 24 min.

  1. 0Is it collusion?Undergraduate3 min
  2. 1Artificial marketsUndergraduate5 min
  3. 2HerdingUndergraduate6 min
  4. 3SimulatorsMaster's3 min
  5. 4Learning to tradeMaster's6 min
  6. 5Language models as tradersPhD3 min
  7. 6Algorithmic collusionMaster's6 min
  8. 7When everyone shares a modelMaster's3 min
  9. 8AI and financial stabilityIndustry3 min
  10. 9Rule 42: test the agent against the market it createsIndustry3 min
  11. For the researcher: when can collusion last?PhD6 min
  12. Recap, desk questions, problemsAll tracks4 min

Also on this page: Lecture · Key results · Try it · Lab · Problems · Reading · 中文 · Build the film.

Lecture

The text of each chapter is the film's narration, as it is spoken, so you can read along or revise without the film. The pictures are in the film.

Is it collusion?Undergraduate3 min

Machines in the market: what happens when the traders are programs that learn, and the market is made of them. Artificial markets, herding, simulators, learning market makers, algorithms that collude without speaking, and crowds that share one model.

Four findings, with their scope. Pricing learners reach a profit index of 81 percent between continuous Nash and monopoly benchmarks; a selected fixed-point subset retaliates after forced undercuts. Reusing another rule's fills gives a wider quote score of 445, against 129 in interactive simulated trading. With independent unit-variance signal components, common weight point two explains 86 percent of a hundred traders' aggregate flow variance. Kirman's specified imitation chain has an exact stationary law. These are model results, not universal market estimates.

The desk question for this part, answered in Chapter six. Two algorithms that never communicate end up quoting wide spreads. Is that collusion? Hold your answer; the economist's and the lawyer's differ.

Why it matters. Automated trading is important in many markets, but automation and adaptive learning are different categories; their shares depend on venue, period and definition. Interacting algorithms can produce collective behaviour that an isolated test misses. The House's proposed research standard therefore includes alternative opponents and copies of a successful policy. Such scenarios test mechanisms without claiming they predict deployment outcomes.

And what this part is not. No agent here is a recommendation, and none traded real money. The House runs no language model as a trader; Chapter five says why, and what a fair test would need. Every learned result comes from the House's own simulators, with fixed seeds.

Where this sits. Act seven, the system. Part forty measured risk and Part forty-one followed it into crises. This part puts machines into the market and watches what they do to it, and to each other. Part forty-three, the last, asks whether anyone beats the market at all.

Thirty years. Alan Kirman's ants; zero-intelligence traders; the Santa Fe artificial market; Lux and Marchesi. Reinforcement learning for execution; the flash crash; Knight Capital; Moore's law against Murphy's. Then Calvano's colluding learners and the ABIDES simulator, the first papers on AI and systemic risk, and the supervisors' reports of twenty twenty-four.

The plan: artificial markets and herding; simulators; a learning market maker; language models as traders; algorithmic collusion, reproduced; crowds that share a model; what supervisors worry about; and the theorem that says when collusion can last.

In the House, the research desk and the market makers bring their learning agents to compliance, which asks a question none of them was trained to answer: what happens to the market when they succeed?

Pause and predict. A market of traders following simple rules: some expect prices to revert to value, some chase trends. Can it produce the real market's fat tails and clustered volatility? And if so, what ingredient would it need?

1Artificial marketsUndergraduate5 min

And a qualified answer to the pause: this chosen switching-agent model generates clustered volatility and heavier tails than its Gaussian comparator. That shows one possible mechanism. It does not prove that imitation is necessary, that fixed-rule markets must have thin tails, or that a matching simulation identifies the real market. We will compare its misses as well as its successes.

The Santa Fe artificial market. Arthur, Holland, LeBaron, Palmer and Tayler gave agents forecasting rules that were selected and recombined. Their reported slow- and fast-learning regimes differed: prices could resemble a rational-expectations benchmark or show technical trading and clustered volatility. These are model-specific results, not a universal convergence theorem. Adaptive interaction offers a possible explanation, rather than a proof that real investors use these rules.

A smaller Franke-Westerhoff-type illustration in the House's module. Fundamentalists trade toward a fixed log fundamental value of zero. Chartists extrapolate the last move and have noisier orders. Net demand moves the log price. Switching attractiveness depends on the population imbalance and squared mispricing, with probabilities clipped at one. This implementation has no separate recent-profit state; the performance-based mechanism comes later in Brock and Hommes.

Two thousand simulated days. The returns come in bursts: calm stretches, then violent ones. And underneath, the chartists' share. When herding tips the crowd into chartism, their noisier, trend-chasing orders dominate, and volatility rises; when a large mispricing pulls them back to fundamentals, it falls. Volatility here has a cause you can see: who is trading.

Side by side, standardized and displayed on the same scale. The last two thousand research-window US market observations through December twenty twenty; March twenty twenty is near the end. A chosen two-thousand-day segment of the agent simulation also shows bursts. A visual resemblance is descriptive, not a held-out validation or evidence of a unique mechanism.

The descriptive statistics. Sample excess kurtosis is 16.7 for the research-window US market and 5.0 for this agent simulation; a Gaussian has population excess kurtosis zero. Hill estimates summarize a selected upper tail and do not prove an exact power law. Small linear return autocorrelations do not establish full unpredictability or efficiency. At lag twenty the absolute-return autocorrelation is 0.23 in the data and 0.23 here. These are descriptive comparisons, without a new fit or causal identification.

Absolute-return autocorrelations across horizons. These research-window US estimates show persistent dependence. The chosen agent simulation also shows persistence; the group share is a state variable that can move slowly. Matching this feature does not identify the real market's cause. Independent Gaussian draws have zero population autocorrelation, while finite-sample estimates fluctuate. Part seven used GARCH to describe such persistence.

The original simulated-moments grid uses eighty-one parameter pairs and a fixed simulation seed. Its loss matches two research-window moments, scaled by their target values. The best tested cell gives kurtosis 7.1 versus 16.7, and lag-twenty dependence 0.25 versus 0.23. This boundary optimum is not a continuous optimum or an unseen forecast. Across this chosen grid the loss changes 2.8-fold overall, but by at most 17 percent along the extrapolation direction at fixed noise. Weak sensitivity here suggests limited parameter information; it is not a general identification theorem. No new tuning is performed.

The mechanism within this simulation. Conditional on the full current state and independent order shocks, the next log-return innovation variance is determined by the squared group shares and their noise scales. Conditioning only on the share can leave extra variation from other state variables. Feedback can make the share persistent. This motivates the structural stochastic-volatility interpretation; it does not identify observed market volatility from the plot alone.

The deterministic cousin, from William Brock and Cars Hommes. Traders choose among forecasting rules with logit probabilities, weighted by each rule's recent profit, so fashions follow performance. As the intensity of choice rises, the steady state at the fundamental value loses stability, first to cycles, then to chaos. They called it a rational route to randomness: no noise needed, only switching toward what worked.

An institutional comparison. Gode and Sunder reported high allocative efficiency for budget-constrained random traders in specified double auctions. It is not guaranteed by arbitrary random trading. Farmer and coauthors studied what selected order-book statistics can follow from a random-flow model. Market rules and adaptive behavior can both matter. These examples do not show that imitation is the only way to produce fat tails or clustering.

Pause and predict. A hundred agents each sometimes switch view on their own, and sometimes copy whoever they happen to meet. If copying is far more common than switching alone, where does the crowd spend its time: evenly split, or somewhere else?

2HerdingUndergraduate6 min

And the answer to the pause: at the extremes. When copying dominates, the crowd spends most of its time almost unanimous, one way or the other, and swings between the two from time to time. It is evenly split only rarely. With a hundred agents, as here, it is unanimous 38 percent of the time.

Kirman's ant-model illustration, using the exact chain in this module. One agent is selected at each step. Spontaneous switching contributes epsilon. Imitation contributes an additional rate proportional to the number holding the opposite view: it is added, not multiplied by one minus epsilon. The displayed up and down probabilities must define a valid chain. The number holding A moves by at most one, giving a birth-and-death chain.

A hundred agents. With copying far more common than independent switching, the share sits near zero or one, and lurches across. Ten times more independent switching, and the same crowd hovers around a half. The agents are identical; only the balance between thinking alone and copying has changed.

The exact finite-population law. For positive epsilon, delta below one, N above one and valid transition probabilities, the stationary distribution is beta-binomial with alpha equal to epsilon times N minus one divided by one minus delta. The Beta limit holds when alpha stays fixed as N grows, so epsilon scales inversely with N minus one. Alpha below one gives a U-shaped limiting density; above one gives a central hump. Keeping epsilon fixed is a different asymptotic regime.

The proof is four lines. A birth-and-death chain is reversible, so detailed balance fixes its stationary law one step at a time. The chance of moving up: pick an agent holding B, then it converts on its own or meets one of the k holding A. Factor out one minus delta over N minus one, and epsilon becomes alpha. The chance of moving down, the same way. The factors cancel, and what is left is exactly the ratio of successive beta-binomial probabilities.

Two forty-million-step runs, after the stated burn-in, are compared with their exact stationary probabilities. The low-switching case puts more mass near the extremes. The higher-switching chain is centrally concentrated, but still contains imitation and is not a population of independent agents. Total-variation differences are 0.009 and 0.005; the two exact finite-state formulas agree to numerical precision. A single long run is a check, not a proof of sampling error bounds.

The recursion gives an exact mean first-passage time for this specified finite chain. The mean time to step down from k satisfies the displayed recursion from the top state. Summing from eleven through ninety gives passage from exactly ninety to exactly ten. The low-switching value is 52,945 steps, versus 52,128 in the sampled simulation. The higher-switching values are 20,632 and 21,087. Simulation is inspected only every ten steps, starts when the sampled state is at least ninety and ends at at most ten. It includes sampling delay and possible overshoot, so it is not an exact observation of the theoretical passage.

Keep alpha fixed at nought point two, adjusting spontaneous switching as population size changes. The exact model probability of unanimity is 38 percent at a hundred agents, 24 at a thousand, and 15 at ten thousand. It falls at the stated power rate. These stationary probabilities concern this chain, not how long real investors agree or a universal empirical scaling law.

The chosen illustrative price adds a sentiment premium to fundamental noise. Low spontaneous switching can create bursts when sentiment changes. Compare the higher-switching case, which still has imitation. Lag-five absolute-return dependence is 0.06 versus 0.02; excess kurtosis is 0.5 versus 0.1. These chosen simulations show different strengths and misses. They do not prove imitation necessary for observed market tails or identify a unique empirical mechanism.

Herding in a market. Thomas Lux and Michele Marchesi built chartists, divided into optimists and pessimists who herd, alongside fundamentalists, all switching by contagion and by profits. It produced fat tails and clustered volatility as bursts of chartist dominance, while prices still tracked fundamentals on average. And Simone Alfarano, Lux and Friedrich Wagner put Kirman's process inside a market model simple enough to estimate, with this chapter's Beta law for sentiment.

In real markets. Josef Lakonishok, Andrei Shleifer and Robert Vishny measured whether more pension funds trade a stock in the same direction than chance would give: a little, mostly in small stocks. And herding can be rational: when others' actions carry information, copying them is sensible, and an information cascade can still be wrong. Machines trained on the same data, or calling the same model, copy each other without ever meeting. That is Chapter seven.

A specific information-cascade model. Two equally likely states, conditionally independent binary signals correct with probability point seven, and sequential observation of actions rather than signals. Before a cascade, an exact posterior tie follows the private signal. When revealed evidence leads by two, one private signal cannot overturn it; later choices reveal no new information. Disagreeing signal pairs cancel; the first agreeing pair has correct-to-wrong odds p squared to q squared. The infinite-horizon wrong-cascade probability is 15.5 percent. The finite forty-agent simulation reports 15.7. This conclusion depends on the information and tie-breaking rules; copying in general need not obey it.

Pause and predict. A simulated market matches the real one on every stylised fact. Is a strategy that works in it likely to work in the real market?

3SimulatorsMaster's3 min

And the answer to the pause: not necessarily, and often not. Matching the stylised facts says the simulator reproduces how prices move when nobody new arrives. A strategy needs something else: how the market responds to its own orders, and how the other traders adapt to it. Neither is in the historical data the simulator was fitted to.

What a modern market simulator is, taking ABIDES as the example. An exchange with a limit order book. Background traders and the strategy being tested. Orders and fills travel as messages with latency. It produces a tape and agent profits. Comparing runs with and without a strategy gives a counterfactual within the specified model. It does not by itself identify the strategy's causal effect in a real exchange.

How to judge a simulator. First, stylised facts: tails, clustering, spreads and depth across relevant horizons. Second, responses to interventions: order impact and its decay, including the approximate square-root regimes discussed in Part thirty-seven. They are empirical benchmarks, not universal laws. Vyetrenko and coauthors proposed both kinds of realism metrics. Matching unconditional statistics does not ensure realistic responses to a new strategy.

Fitting one to data. Simulated moments choose parameters to match selected statistics. Weights determine which discrepancies matter; matching them does not identify every behavioural mechanism. Event models or generative networks can also learn order-book dynamics. Their counterfactual validity under unfamiliar policies needs separate evidence; neither a close fit nor a behavioural story guarantees it.

So the gap between simulation and reality has three sources. Artefacts: a learner finds whatever pays in the simulator, including its simplifications. A noise trader that is too patient is free money. The counterfactual: history shows how the market moved without you, and how it would move with you is assumed, not measured. And adaptation: real competitors learn back, so a strategy that pays changes the population that made it pay.

This is an old problem in economics. Lucas argued that estimated relations can change when policy changes because people respond. Agents with objectives let a researcher recompute behaviour under new rules, but their objectives, beliefs and adaptation still need justification. They do not automatically solve the identification problem. A historical example is the Bank of England model of bond funds and dealers used to examine fire-sale mechanisms under stress.

The dealer simulator used here is deliberately small. A latent value moves by a tick; informed traders observe its current value, not its next innovation. They buy below that value or sell above it. Noise participation falls exponentially with quote distance. The maker chooses width and inventory skew. Its score is latent-value marked profit and loss less an inventory penalty, rather than cash profit alone. The value innovation occurs after the trading decision.

What this simulator leaves out. There is one maker, no order book, queue or speed race. The other traders do not learn. The maker observes only inventory and last trade, so different hidden value gaps share an observation. Failures can reflect this partial observation, the learning method, or model assumptions. A small simulator makes these mechanisms easier to audit; it does not make every failure the learner's fault.

Pause and predict. A market maker learns its quotes by trial and error in a market where five percent of traders are informed. It is then deployed where thirty percent are. Does it lose money? And does it do worse than one trained in the harder market?

4Learning to tradeMaster's6 min

In this fixed-seed experiment, the learner trained with five percent informed traders scores 89 per session in the thirty-percent market. The learner trained there scores 89; the best of eight tested fixed rules scores 113. These are risk-penalised scores from finite training and evaluation, not proof that training regime never matters or that a particular method is universally superior.

Reinforcement learning in finance, so far in this series. Hedging: Part seventeen's deep hedging, learned on simulated paths. Execution: Part thirty-seven's queue executor. And market making and allocation: quotes or weights as actions, inventory or holdings as the state. Ben Hambly, Renyuan Xu and Huining Yang survey all four. Each needs an environment to learn in; here all training and scoring take place in a simulator.

The dealer's learning interface. Inventory and last-trade side give thirty-nine observations. They omit the hidden gap between the maker's mid and latent value, so this is partially observed rather than a fully observed Markov decision process. Actions choose a half-spread and inventory skew. Reward is latent-value marked profit and loss less a risk penalty. Tabular Q-learning runs for twenty-four thousand sessions with a constant step size, then greedy policies are scored on fresh sessions. Classical convergence guarantees do not follow from this setup.

One illustrative session under the selected fixed rule. The informed observe current latent value; the maker sees trades instead. The maker's mid follows order flow and can lag the value. Inventory changes with fills and the skew encourages unloading. There are 110 trades in four hundred steps. This path illustrates the mechanism; it is not a performance distribution.

First, the eight fixed rules in the fifteen-percent market. In these evaluations, narrow quotes face adverse selection and wide quotes reduce noise participation. The highest mean in this tested grid is the skewed 3-tick rule at 157 per session. These scores include the inventory penalty. Selecting the best evaluated rule is a finite-grid comparison, not an independently confirmed global optimum.

Now the learners. The top row selects the highest mean among eight tested fixed rules in each market. The five-percent learner scores 153 in its training regime, about 85 percent of that grid benchmark's 179. In the thirty-percent market the two learners score 89 and 89. This one training seed and finite evaluation do not establish equivalence, convergence, or the value of further training. Repeated independent training runs would be needed to separate those effects.

Greedy-policy evaluations during this training run. At five hundred sessions the score is 156. A later snapshot reaches 114 after 12,000 sessions. The last scores 153, against the selected fixed benchmark's 179. Noisy snapshot scores need not improve monotonically. Constant step size, partial observation and finite samples prevent this curve from establishing convergence or proving that longer training cannot help.

Why a simple rule can be competitive. With an isolated exponential fill law, maximising distance times fill rate gives one over k. That is a useful reference, not the exact optimal quote in this partially observed dealer model. Here one over k is two ticks, while adverse selection and inventory incentives alter the tested rule's performance. Structural knowledge can reduce the search burden. The comparison is conditional on this model, these actions and this training budget; it does not establish a universal winner between model-based and learned policies.

The easy-market learner's frozen policy after a quiet step. Near flat it selects widths from two to four ticks. With inventory it often skews toward unloading. Neighbouring cells can disagree, but the table alone does not tell us whether rare visits, reward noise or hidden-state aliasing caused the differences. It shows the chosen actions rather than identifying why they were learned.

The regime comparison. The easy-market learner averages about three ticks. The hard-market learner quotes more tightly in this run. These averages depend on both policy and visited observations; they do not identify a structural response to informed trading. Finite training, hidden state and distribution shift are confounded here. The result motivates repeated training and controlled evaluation, rather than proving that regime choice is irrelevant.

And why a backtest is not an environment. Record a session of the two-tick rule: who traded, and when. Live, it earns 143. Now evaluate a four-tick rule on that tape, the usual way: same trades, two ticks better each. It looks worth 445. Run it live and it earns 129, less than the two-tick rule, because wider quotes drive the noise traders away. The tape recorded who traded with the old quotes, not who would have traded with the new ones.

Offline policy evaluation asks what a new policy would earn from an old policy's logged experience. Logs contain chosen actions and subsequent outcomes. A new sequential policy can change future observations as well as current rewards. Trajectory importance weighting therefore uses products of action-probability ratios, under consistent propensities, suitable observation or confounding assumptions, and sequential overlap. It can have extreme variance. A deterministic two-tick log has no support for four ticks; reusing its fills cannot supply the missing counterfactual.

Why a table, when the field uses deep networks? Deep reinforcement learning replaces the table by a network, or learns the policy directly, so that states too numerous to list, like a whole order book, can be handled. It does not fix the sample efficiency, the simulator's assumptions or the missing counterfactual, and a network can overfit a simulator's quirks more thoroughly. Thirty-nine observations can be printed and read, so the House can see what was learned, not only what it earned.

Pause and predict. Language models read the news and write trading plans. What is the hardest problem in testing one on historical data?

5Language models as tradersPhD3 min

A language model may have encountered later news about historical test events during training. A training cutoff does not prove it read every event, but contamination can make apparent trading skill difficult to distinguish from recall. Part twenty-eight examined this timing problem with small chronologically consistent models. Here we discuss evaluation requirements; no language-model trader is executed in this part.

Three ways they are used, as the research describes them. As readers: a model scores news for a separate trading rule, Part twenty-eight's tone. As planners: an agent reads, reasons in text and outputs an order, sometimes as a pipeline of analyst, trader and risk manager. And as populations: many agents in one simulated market, to see what prices they make together.

Why simulators can help test language models. Historical outcomes may overlap training material. Newly generated events reduce direct outcome recall, but familiar templates, benchmark leakage and exploitable simulator rules can remain. Synthetic novelty alone is not a clean test of general reasoning. Results are evidence about that simulated environment. Transfer to real execution and unfamiliar market conditions requires separate validation.

What an honest test would need. Training data that end before the test window begins. A registered record of prompts, versions and every run, because each rewording is another trial on the counter. Costs, and Part twenty-six's deflation for the number tried. And a baseline: the simplest rule using the same text. What the language model adds is the difference.

Two ways to improve timing discipline. Use a frozen model whose training information predates the whole test window, or use documented rolling vintages. A new model for every date is not required. Historical vintages test those older models and their recorded information sets. A prospective test after release also needs frozen prompts, data rules, model versions and a record of all trials. Release timing alone does not prevent adaptation to test outcomes.

A potential concentration risk. The Financial Stability Board's twenty twenty-four report discussed reliance on common AI providers. Shared models and inputs can correlate decisions, but prompts, constraints and execution can also make actions differ. Chapter seven isolates a common-signal mechanism. Sharing a model alone does not imply herding or the stationary distribution of Chapter two's particular imitation chain.

Possible market effects depend on deployment. Faster text processing can speed some information into prices, but errors and execution frictions remain. Similar inputs and decision rules can create correlated order flow; this is a risk mechanism, not a measured universal outcome. Misleading or malicious text can affect machine readers. Provenance, validation, access controls and risk limits all matter; no single defence eliminates that risk.

What this part establishes. It runs no language model as a trader, so it supplies no direct performance evidence about one. The small dealer simulator and fixed-rule baselines illustrate some evaluation problems. A real trial would additionally need a frozen information set, costs and complete prospective accounting of configurations. Results here cannot establish the current absence or presence of profitable language-model trading at scale. That is a separate empirical question.

Pause and predict. Two pricing algorithms learn by trial and error. They never communicate, and they set prices against each other again and again. Do they end up at competitive prices?

6Algorithmic collusionMaster's6 min

In this fixed-budget pricing experiment, the high-discount learners' mean price is 1.77, compared with continuous-action Nash 1.47 and joint-monopoly 1.92. Their profit interpolation index is 81 percent of the gap between those benchmark profits. That percentage is not a fraction of the price gap. The algorithms exchange no explicit messages, but observe each other's previous prices.

The experiment, from Emilio Calvano, Giacomo Calzolari, Vincenzo Denicolò and Sergio Pastorello. Two firms sell similar goods against logit demand. Each earns its margin times its demand. If they meet once, each best-responds and the price is 1.47; a monopolist owning both would charge 1.92. The algorithms choose from fifteen prices spanning both.

The learners. Each remembers only last period's two prices. It keeps a table of how good each price is in each state, and nudges the entry toward the profit it got plus the discounted value of what comes next: Part eight's Q-learning. It explores at random, less and less. Ninety-six independent sessions of a million and a half periods each. The measure: how far profits sit between competition, zero, and monopoly, one.

Results across the tested discount factors. Myopic learners have mean profit index 0.23. Grid effects and finite learning can put this above continuous-action Nash. The high-discount runs have larger average indices, but the tested sequence is not monotone: it first dips at discount point two five. At discount nought point nine five the index is 0.81. These finite runs show supra-competitive outcomes; they do not prove convergence or that patience is necessary for every form of algorithmic price elevation.

At discount nought point nine five, each dot summarises one frozen pair's post-training prices. The continuous Nash and monopoly points are references, not the complete equilibria of the fifteen-price game. Equal prices occur in 32 percent of sessions. The remaining policies may cycle or be asymmetric. The recurrence search is capped at two hundred steps, below the two hundred twenty-five possible states. Among the 56 sessions classified as fixed points, 95 percent meet this forced-undercut punishment criterion. This conditional percentage is not a rate across all sessions or proof of subgame perfection.

A forced-deviation diagnostic, conditional on 56 sessions classified as fixed points. Firm one is forced to its best response for one period, after which both frozen policies resume. The mean rival price falls. The average response returns near its starting level after about 5 periods. A return in the mean does not imply every session returns. This reward-and-punishment pattern is evidence of possible coordination, not a proof of equilibrium, intent or a legal agreement.

In financial markets. Jean-Edouard Colliard, Thierry Foucault and Stefano Lovo put Q-learning dealers against each other: their spreads sit above the competitive level, but less so when adverse selection makes profits riskier, as they report. Winston Dou, Itay Goldstein and Yan Ji gave learning algorithms to informed speculators: they trade less aggressively than competition would make them, and prices carry less information. For a dealer the price is the spread, and a punishment is a tighter quote after a rival undercuts.

A separate payoff-noise experiment. Independent zero-mean noise is added to period profits; it is not an adverse-selection model. The plotted outcomes depend on the tested noise levels and finite learning budget. At the largest level the mean profit index is 0.43. Noise can disrupt learned reward signals, but this experiment does not identify the effect of informed traders, who change conditional payoffs and incentives.

Some conditions can facilitate coordination. Few sellers, repeated interaction, observable prices and stable demand appear in the industrial-organisation literature. Algorithms can interact frequently and retain histories, but their information, constraints and learning rules vary. Electronic markets can combine rapid interaction with concentrated participation. Hidden liquidity, asynchronous decisions, entry and adverse selection complicate the analogy; automation alone does not imply collusion.

And why the number of sellers matters, in one line of algebra. With identical goods, colluding firms split the monopoly profit, a firm that undercuts slightly takes all of it, and competition leaves nothing. The research chapter's threshold becomes one minus one over n. Two sellers need a discount factor of a half; ten need nine tenths. Calvano and coauthors report less collusion with three and four learners, as the formula suggests.

Economic and legal questions differ. High prices plus a retaliatory response are coordination diagnostics, but frozen policies require further deviation checks before equilibrium claims. Legal treatment depends on jurisdiction, agreement, information exchange and conduct. A simulation cannot establish a violation or a general safe harbour. Assad and coauthors report evidence from German petrol pricing that margins rose where both stations in local duopolies adopted algorithms. That empirical setting is distinct from this simulator.

A dated example of enforcement allegations. In August twenty twenty-four the US Justice Department sued RealPage over alleged coordination through rent-pricing software and shared information. This describes that complaint, not the case's current status or a finding of liability. A shared pricing intermediary is structurally different from two independent learners in our experiment. Vendor models deserve scrutiny for shared information, constraints and feedback, without assuming that licensing one model itself establishes unlawful coordination.

Pause and predict. A hundred traders use orders x i equal to point two times a common signal plus point eight times a private signal. All signal components are independent, mean zero and unit variance. What fraction of the variance of their summed order flow comes from the common signal?

7When everyone shares a modelMaster's3 min

Under the pause's independent unit-variance signal assumptions, the common component accounts for 86 percent of aggregate flow variance. Point two is a signal coefficient, not a realised fraction of every trade. Private components partly diversify rather than cancelling exactly. This arithmetic illustrates one common-input mechanism; sharing a model does not by itself establish these assumptions in a real market.

The concern, stated before the language-model boom. Gary Gensler and Lily Bailey argued in twenty twenty that deep learning could raise systemic risk through uniformity: similar models, trained on similar data, bought from few providers. Jon Danielsson, Robert Macrae and Andreas Uthemann argued that risk engines that learn the same lessons make risk management more procyclical. The mechanism is not a bad model. It is the same model everywhere, so that one error is everyone's error at once.

The arithmetic. The common signal and all private components are independent with zero means and unit variances. Orders themselves are correlated. Summed flow has common variance N squared w squared and private variance N times the square of one minus w. Their ratio gives the common fraction. At fixed positive w it increases with N. For w point two and N one hundred, it is four over four point six four, about eighty-six percent. This is a variance fraction, not a share of realised order volume.

A hundred traders with linear price impact. At common coefficient point two, simulated volatility is 2.2 times the zero-common benchmark. The theoretical curve uses unmodified unit-variance signals; the five-thousand-observation simulation includes one inserted shock, so its dots need not equal that curve. Total variance initially falls to its minimum at w equal to one over N plus one, then rises. Labels show theoretical common variance fractions, not the fraction of everything the market trades or a measured AI contribution.

One deliberately inserted shock. The source adds positive four to the existing random common signal on the selected day. At zero common weight, that addition has no effect, but private orders still generate a return. At weight point two, the selected day's total return is 11 baseline volatility units. That includes the original random signals; the inserted addition alone contributes eight units. This upward realisation illustrates amplification, not a downward crash, a four-sigma total draw or a frequency estimate.

A possible empirical diagnostic. Fit a factor model to a vector of order flows. The displayed variance fraction assumes factor-residual orthogonality and a suitable factor specification. More common variation can reflect shared news, benchmarks or rebalancing as well as similar models. It does not identify AI uniformity or predict a crisis on its own. Data coverage and model uncertainty must accompany any reported estimate.

Three implications, conditional on the mechanism. Shared exposures can create an externality when firms do not bear all amplification costs. Diversity can help, but its value depends on accuracy, liquidity and responses. Different data, horizons and objectives may reduce alignment; market controls need their own evaluation. Test a strategy against copies of itself and alternative populations. This is a stress scenario rather than a prediction that successful strategies will all be copied.

Pause and predict. The International Monetary Fund and the Financial Stability Board both reported on artificial intelligence in finance in twenty twenty-four. What do you think worried them most?

8AI and financial stabilityIndustry3 min

The dated twenty twenty-four IMF and Financial Stability Board reports identified correlation and provider concentration among potential risks, alongside cyber, operational and model risks. They discussed mechanisms and important information gaps. This chapter describes that historical assessment, not a claim about the current prevalence or absence of AI-driven instability.

The reports in their historical framing. The IMF's October twenty twenty-four report discussed faster trading, correlated strategies and potential stress amplification, with implications for market safeguards. The FSB's November report highlighted provider dependence, market correlations, cyber risk, model risk and governance. It called for better monitoring and closing information gaps. Those reports are dated evidence about potential vulnerabilities, not a current estimate of realised systemic effects.

Selected rules and historical dates, rather than a complete legal survey. EU requirements for covered investment firms engaged in algorithmic trading include testing, pre-trade controls and kill functionality. The US market-access rule applies to broker-dealers with relevant market access and requires financial and regulatory controls. The EU AI Act names natural-person creditworthiness and life or health insurance risk assessment among high-risk uses. Its scope and phased application require separate analysis; trading is not categorically exempt from AI, data or financial law. The SEC withdrew its twenty twenty-three predictive-analytics conflicts proposal in June twenty twenty-five. This is the history of that proposal, not a statement that no other duties apply.

Andrei Kirilenko and Andrew Lo put the problem in two laws. Moore's law: computing keeps getting faster and cheaper, so more trading is automated. Murphy's law: whatever can go wrong will, and at machine speed it goes wrong before anyone can step in. The risk is the gap between them: technology that outruns the controls built for slower markets.

Different historical failures illustrate different controls. The twenty ten flash crash involved stressed order flow and liquidity feedback. Knight Capital's twenty twelve deployment and routing failure generated unwanted positions; the SEC later reported losses above four hundred sixty million dollars. The twenty fourteen Treasury event included a sixteen-basis-point yield round trip in twelve minutes, without an apparent new public catalyst in that narrow window. Sterling fell sharply in thin Asian trading in twenty sixteen. These are not established examples of language-model trading failures, nor do they share one proven cause. Knight in particular was an operational failure, not simply simultaneous liquidity withdrawal.

Model-risk management offers an older framework. US banking guidance issued in twenty eleven emphasised independent validation, documented limitations and monitoring, scaled to model use and risk. Retraining changes the model, so validation should address the training procedure, data changes and deployment controls as well as individual versions. Firms and designated people retain responsibilities under the applicable regimes. A simulator's approval label does not substitute for those duties.

So the controls come in three layers. Inside the firm: limits and kill switches outside the model, which it cannot learn its way around. At the exchange: price bands, pauses and batch auctions that slow a crowd down. And in the system: diversity of models, data and providers, and better data to measure concentration and common exposures.

Pause and predict. Before the House lets a learned agent trade, what should it be tested against, besides the market it was trained on?

9Rule 42: test the agent against the market it createsIndustry3 min

Four proposed evaluation dimensions. Test regimes unlike training. Test copies and alternative opponents. Force deviations and examine responses; retaliation is a coordination warning rather than a standalone equilibrium or legal test. Use an interactive simulator where quotes change fills, while recognising that simulated execution is still not real-market deployment evidence.

Chapter nine. The House's forty-second rule belongs to its research desk and its market makers, with compliance watching. A learned agent is evaluated not only in the market it was trained on, but in the market its own success would create.

What these experiments contribute. The hard-market learner scores about 89, against 113 for the best tested fixed rule. One training run cannot isolate a regime effect. With independent unit-variance components, common coefficient point two gives 86 percent of aggregate flow variance. Pricing policies show supra-competitive prices and conditional retaliation. Fixed-fill replay exaggerates the illustrated wider-quote score. These are research diagnostics. They do not constitute a completed deployment approval process.

A proposed coordination stress test. Train against copies across seeds and inspect frozen-policy behaviour, allowing for cycles and incomplete recurrence searches. Force a one-period deviation. Inspect individual responses as well as their average. Retaliation and recovery trigger further analysis of profitable deviations, information exchange and applicable law. This procedure is a diagnostic, not proof that a learned policy is an equilibrium or a legally prohibited agreement.

Proposed governance around the experiments. Independent limits and a human-controlled stop mechanism should sit outside the learned policy. Review shared data, objectives and providers for common exposures; diversity alone is not a guarantee of stability. A real prospective study should record configurations, seeds and retraining before evaluation. This part describes that standard without creating or opening a strategy trial registry.

And the agent registry. An agent is its code, its data, its seed and the version of the simulator it learned in: enough to rebuild it exactly. Each retraining makes a new agent, and a new trial on the House's counter. And approval means the four tests, re-run on every new agent. An agent that passed last month and has retrained since has not passed.

The House's code for Chapter six. After both firms choose, the new state is the pair of prices. Each firm takes its profit, adds the discounted value of the best price in the new state, and moves its table entry a step toward that target. Nothing in it mentions a rival's intentions, or collusion.

And the audit. Force firm one to its best response to firm two's price for one period, then let both play their learned strategies and record the prices that follow.

The tools this part adds, in the House's agents module. Artificial markets and herding; a dealer market and its learner; collusion and monoculture. And the forty-second rule. A learned agent trades only after it has been tested in markets it never trained in, against copies of itself, against a forced deviation, and live rather than replayed. And its limits sit outside it.

Three tests to carry away. When an agent did well in a simulator, ask what the simulator assumed about how others respond, and how the agent did in regimes it never saw. When prices stay high without an agreement, ask what happens after one seller cuts. And when many firms use one model, ask what share of the flow it drives, and what one mistake would do.

For the researcher: when can collusion last?PhD6 min

For the researcher. We derive a grim-trigger incentive condition in an infinitely repeated, perfectly monitored game with common action domains and a credible static-Nash punishment. We then compare that continuous-game benchmark with finite-grid learning outcomes. The comparison does not certify the learners' equilibrium. A separate grid-restricted punishment calculation will be labelled as illustrative algebra rather than a general bound.

Three numbers from the one-period game. Pi c, each firm's profit when both charge a collusive price. Pi d, the most a firm can earn in one period by undercutting a rival who keeps that price. And pi n, the one-shot Nash profit. Undercutting pays today, colluding pays more than competing, and the game repeats forever with payoffs discounted by delta.

The tool. A strategy profile is subgame perfect if and only if no player can gain by deviating at a single history and then going back to the strategy. In discounted games with bounded payoffs, any profitable deviation can be cut short to a profitable one-shot deviation, because the far future counts for little. So it is enough to check one period at a time.

The proof sketch. Suppose a deviation improves continuation payoff by epsilon at some history. With absolute stage payoffs bounded by M, truncation after T periods changes payoff by at most two M delta to the T over one minus delta. Choose T large enough to preserve a gain. If no one-shot deviation is profitable at any history, remove the last deviating date without lowering payoff, then work backwards through every earlier date. That contradicts the profitable finite deviation. This uses discounted bounded payoffs and the standard perfect-monitoring strategy framework.

The theorem. The grim-trigger strategy, charge the collusive price as long as both always have, and the Nash price forever after any deviation, is a subgame-perfect equilibrium exactly when delta is at least pi d minus pi c, over pi d minus pi n. Patience must exceed the temptation to deviate, measured against the cost of the punishment.

The proof, by the lemma. Off the path, after a deviation, both charge the Nash price forever. That is subgame perfect: against a rival who will charge Nash whatever you do, no one-shot deviation pays. On the path, compare colluding forever with deviating once, earning pi d, and then Nash forever. Multiply through by one minus delta. And rearrange. Because pi d exceeds pi c, which exceeds pi n, the threshold lies strictly between zero and one.

A finite-punishment strategy needs its off-path rule specified. After deviation, play static Nash for T periods; any deviation during punishment restarts the clock. Then return to collusion. On the cooperation path, deterrence requires today's gain to be no larger than the discounted loss during T punishment periods. During punishment, Nash best response prevents a current gain and restarting delays the better continuation. A finite threshold below one exists only when T times the per-period punishment loss exceeds the deviation gain. Longer feasible punishments approach grim trigger.

Continuous-action logit benchmarks. These are the collusive, best-deviation and Nash profits for the stated action domain. The grim-trigger threshold is 0.39. A one-period Nash punishment requires 0.65; a five-period one requires 0.40, using the specified restart rule. The selected lower collusive prices give the displayed thresholds. The learners use fifteen prices, so their exact incentive constraints must be computed in that discrete game before claiming equilibrium.

An important domain warning. The displayed minimisation takes a pure opponent price on the fifteen-point grid and a best response on that grid. It yields 0.204; this is not a mixed-action minmax calculation. Inserting that value alongside continuous-action monopoly and deviation profits gives the illustrative ratio 0.36. Because the action domains differ, it is not a universal lower bound or an established optimal penal code. The continuous grim reference is 0.39. Abreu's theory concerns credible continuation punishments under explicit game assumptions; this computation does not establish attainability of its illustrative ratio.

Comparing a theoretical reference with finite learning. The shaded region permits continuous-action monopoly under the specified grim strategy. At discount one half the learners' finite-run profit index is 0.21; higher tested discounts have larger averages. The grim threshold characterises that strategy, not every collusive equilibrium, and the learning game is discrete. These sessions do not prove a necessary patience threshold for learning. Exploration and coupled estimates are possible mechanisms, not identified causes from this chart alone.

The mean learned impulse response returns near baseline after about 5 periods in the selected fixed-point subset. It is not a deterministic five-period Nash punishment. The theoretical five-period strategy has continuous-game threshold 0.40, below the learners' discount point nine five. Similar duration does not establish the learned policies' incentives at every history. Further deviations, individual responses and discrete action constraints need checking before an equilibrium claim.

Why learners find collusion at all. Not by reasoning about equilibria. A Q-learner's estimate of a price's value depends on what its rival is doing, so the two learners' errors move together. Martino Banchio and Giacomo Mantegazza call this spontaneous coupling, and show it can hold prices up even without memory or patience. And Sara Fish, Yannai Gonczarowski and Ran Shorrer report that pricing agents built on language models reach high prices in such games too.

Related theory, with its assumptions kept visible. Folk theorems describe broad sets of feasible individually rational payoffs for sufficiently patient players under appropriate monitoring and game conditions; they do not select the outcome a learner reaches. Green and Porter show how imperfect monitoring can generate equilibrium price wars. Independent additive payoff noise here is only a loose analogy. Brown and MacKay analyse price algorithms and commitment through differing revision frequencies. High prices need not have the same mechanism in every algorithmic market.

Three open problems. A theory of learning: which equilibria learners reach, how fast, and how that depends on exploration and memory. Detection: tests that distinguish learned collusion from competition in market data, without seeing the algorithms. And design: market rules that make learned collusion unprofitable.

Pause and predict. With zero discounting, the grim-trigger mechanism cannot sustain a price with a profitable current deviation. Yet these finite-grid myopic learners can score above the continuous Nash reference. Give two possible explanations, and say why that does not prove a repeated-game equilibrium.

Recap, desk questions, problemsAll tracks4 min

Part forty-two in thirteen lines. Selected adaptive-agent models generate tails and clustered volatility; they do not identify a unique market mechanism. Kirman's chain has an exact beta-binomial stationary law. Matching historical moments does not validate intervention responses. In one partially observed dealer experiment, finite-trained learners trail the best tested fixed rule. And reusing fixed fills does not reproduce a new policy's interactive execution.

No language-model trader was run here. Finite pricing experiments show supra-competitive profits and conditional retaliation, without certifying equilibrium or legal agreement. Common signals can dominate aggregate flow variance under explicit assumptions. Dated supervisory reports highlight concentration and correlation risks. The research chapter proves a specified grim-trigger condition and distinguishes it from mixed-domain illustrative calculations. Rule forty-two proposes testing agents against alternative markets and populations.

Three lessons. Market behaviour depends on agents, institutions and their interaction; matching a pattern is not unique causal identification. Learning can exploit reward definitions and simulator artefacts, so performance needs independent checks. Shared exposures can amplify shocks, while diversity may reduce alignment under suitable conditions. Neither learning nor diversity guarantees stability.

The part on one card. The fundamentalist and chartist market. Kirman's exact law. The Q-learning update. The collusion thresholds, grim and finite. And the common share of a crowd's flow.

How this part connects. Backwards: volatility models, Q-learning, the trial counter, look-ahead, the market makers of Parts thirty-five to thirty-eight, and Part forty-one's herding. Sideways: collusion is spread competition with memory, and monoculture is common holdings made of models. Forwards: Part forty-three asks whether, in a market of such agents, anyone beats the market.

Six desk questions. The hook asks whether wide spreads prove collusion. They do not. Retaliation is a diagnostic; equilibrium and legal conclusions require more evidence. Why is a tape not an interactive environment? New quotes change who fills them. What should simulator evaluation check? Responses to interventions, unfamiliar regimes, alternative opponents and assumptions behind the mapping to real trading.

How does herding cluster volatility? Through a slowly moving share of trend-followers. Why does a shared model matter? Its parts add coherently. And when can grim trigger hold the monopoly price? Above the threshold proved in the research chapter. Full solutions are in the notes.

The research pause, answered. Discretisation changes the one-period game. Its listed equilibrium indices are -0.02 and 0.12, relative to continuous-action benchmarks. Finite learning need not reach either equilibrium: 89 percent of myopic sessions have reported indices above the higher listed grid equilibrium. Coupled learning estimates are one literature mechanism, but this statistic alone does not identify the cause or prove a repeated-game equilibrium.

And twelve problems: why size is predictable when returns are not; Kirman's alpha; its detailed balance; the best spread against elastic noise traders; the replay bias; the logit Nash price; collusion thresholds; the common share; a shared model's error; and collusion on a grid. Then two qualifying-exam problems: the one-shot deviation principle with its consequences, and Kirman's law in full. Solutions, in English and Chinese, are in the notes.

Where this comes back. Part forty-three, the last, asks whether anyone beats a market made of agents like these, and why Andrew Lo called markets adaptive.

The references separate reported historical episodes, published theoretical and simulation results, and this part's fixed-seed calculations. The only downloaded market series used here is Kenneth French's daily research-window data through twenty twenty. Source citations and the limits of the experiments are in the bilingual notes.

The House's proposed rule is to test agents against markets and opponents their deployment could create. Next, Part forty-three asks whether anyone can beat the market: Sharpe's arithmetic, luck versus skill and the evidence required for a performance claim. This continuation makes no promise to open sealed strategy outcomes.

Where it goes next. The finale asks what, after all of this, is left to earn.

Key results

The part's results in one place, for revision.

Herding: stationary law\[\pi(x)\propto x^{\frac{\varepsilon N}{1-\delta}-1}(1-x)^{\frac{\varepsilon N}{1-\delta}-1}\quad(\text{large }N)\]
Grim trigger\[\delta\ \ge\ \frac{\pi^D-\pi^C}{\pi^D-\pi^N}\]
Q-learning\[Q(s,a)\leftarrow(1-\alpha)\,Q(s,a)+\alpha\bigl[r+\delta\max_{a'}Q(s',a')\bigr]\]
Collusion index\[\Delta=\frac{\bar\pi-\pi^N}{\pi^M-\pi^N}\]

Try it

Lab 42 · Herding and the stylized facts

A hundred traders hold one of two views and convert each other at random. Simulate the share holding each view and compare it with the exact stationary law as the rate of independent switching falls. Then run a market of fundamentalists and chartists and measure its tails and its volatility clustering.

Figure produced by Lab 42: Herding and the stylized facts
Produced by the lab below, seed 0, in 0.5 s. Simulated data.
python -m videos.quant.labs 42 needs numpy, scipy, matplotlib, numba · download lab42.py · source on GitHub
eps = 0.0005                   time with more than 90% on one side: simulated 85%, exact 87%
eps = 0.1                      time with more than 90% on one side: simulated 0%, exact 0%
Fundamentalists and chartists  excess kurtosis 4.3, tail exponent 3.7, autocorrelation of |r| at lag 1: 0.27, of r: +0.01

No news arrives in either model. Fat tails and volatility clusters come from traders copying each other; returns stay unpredictable.
The code (54 lines; it asserts its own result)
"""Lab 42: herding makes fat tails: Kirman's ants, and a market of fundamentalists and chartists."""

import numpy as np

from videos.quant import labs
from explainer.quant.house import agents

TITLE = "Herding and the stylized facts"
GOAL = ("A hundred traders hold one of two views and convert each other at random. Simulate the share holding "
        "each view and compare it with the exact stationary law as the rate of independent switching falls. Then "
        "run a market of fundamentalists and chartists and measure its tails and its volatility clustering.")
TASKS = [
    "Find the critical eps at which the stationary law turns from one hump to two (it depends on N).",
    "In agents.fw_model, switch herding off (a_n = 0). Which stylized fact disappears first?",
    "Give every trader the same forecasting model (agents.crowd). What does a shared error do to volatility?",
]


def run(seed=0):
    N, delta, T = 100, 0.3, 400000
    lab, sims = labs.Lab(), {}
    for eps in (0.0005, 0.1):
        k = agents.kirman(N, eps, delta, T, seed=seed)
        emp = np.bincount(k[T // 20:], minlength=N + 1) / (T - T // 20)
        th = agents.kirman_stationary(N, eps, delta)
        sims[eps] = (k, emp, th)
        ends = emp[:11].sum() + emp[-11:].sum()
        lab.row(f"eps = {eps}", f"time with more than 90% on one side: simulated {100 * ends:.0f}%, exact "
                                f"{100 * (th[:11].sum() + th[-11:].sum()):.0f}%")
    out = agents.fw_model(T=40000, seed=seed)
    st = agents.stylized(out["r"])
    lab.row("Fundamentalists and chartists", f"excess kurtosis {st['kurt']:.1f}, tail exponent {st['hill']:.1f}, "
                                             f"autocorrelation of |r| at lag 1: {st['acf_abs'][0]:.2f}, of r: {st['acf_r'][0]:+.2f}")
    lab.note = ("No news arrives in either model. Fat tails and volatility clusters come from traders copying "
                "each other; returns stay unpredictable.")
    lo, hi = sims[0.0005], sims[0.1]
    assert lo[2][0] > lo[2][50] and hi[2][50] > hi[2][0], "herding: two humps; independence: one"
    assert abs((hi[1] * np.arange(N + 1)).sum() - 50) < 3 and st["kurt"] > 1 and st["acf_abs"][0] > 0.1 > abs(st["acf_r"][0])

    fig, ax = labs.figure(3, size=(12, 3.9))
    step = 200
    ax[0].plot(np.arange(0, T, step) / 1e3, lo[0][::step], color=labs.LOSS, lw=0.7, label="eps = 0.0005")
    ax[0].plot(np.arange(0, T, step) / 1e3, hi[0][::step], color=labs.SPOT, lw=0.7, label="eps = 0.1")
    ax[0].set(title="Traders holding view A", xlabel="thousand meetings", ylabel="of 100")
    ax[0].legend(fontsize=8)
    kk = np.arange(N + 1)
    for (k, emp, th), c in ((lo, labs.LOSS), (hi, labs.SPOT)):
        ax[1].bar(kk, emp, width=1.0, color=c, alpha=0.4)
        ax[1].plot(kk, th, color=c)
    ax[1].set(title="Time spent at each share: simulation and exact law", xlabel="traders holding view A", ylim=(0, 0.06))
    ax[2].plot(100 * out["r"][:6000], color=labs.SPOT, lw=0.4)
    ax[2].set(title="Returns of the two-type market", xlabel="period", ylabel="%")
    lab.fig = fig
    return lab

Now change it

  1. Find the critical eps at which the stationary law turns from one hump to two (it depends on N).
  2. In agents.fw_model, switch herding off (a_n = 0). Which stylized fact disappears first?
  3. Give every trader the same forecasting model (agents.crowd). What does a shared error do to volatility?

Problems, with solutions

Try each problem before opening its solution; the last two of each set are at qualifying-exam level.

Desk questions, with solutions

Six desk questions, with solutions

  1. Do wide spreads and a forced-undercut response prove collusion?
    AnswerNo. They motivate coordination analysis. Check individual policies, profitable deviations at relevant histories, information exchange and applicable law. The simulated fixed-point subset and its conditional punishment rate cannot support a universal economic or legal conclusion.
  2. Why is a tape not a new quoting policy's environment?
    AnswerQuotes alter participation and adverse selection. Adding two ticks to every old fill holds the response fixed; it does not reconstruct the trades the wider quote would receive. The example's replay score is about 445 versus 129 in interactive simulation.
  3. What should simulator-trained policies face?
    AnswerAlternative regimes, opponents and copies, plus response metrics rather than unconditional moments alone. Report hidden-state omissions, model assumptions, independent training variability and the cost/information protocol needed for real deployment.
  4. How can switching create clustered volatility?
    AnswerPersistent group shares alter conditional innovation variance under the complete state. Conditioning on a share alone may leave additional state-dependent variance. This is one possible mechanism, not unique identification of actual volatility.
  5. Why can a small common coefficient matter?
    AnswerAt N=100,w=0.2, common variance is 400 and private variance 64, giving 400/464≈86.2%. Private components diversify but do not cancel exactly. A +4 common increment adds eight baseline volatility units under the specified impact rule; it is not a frequency estimate.
  6. When does grim trigger sustain monopoly?
    AnswerUnder the theorem's game and monitoring assumptions, compare pi_c/(1−delta) with pi_d+delta pi_n/(1−delta). Rearrangement gives the stated threshold, about 0.3931 for the continuous logit benchmark.

Problems, with worked solutions

Twelve problems, with full solutions

The first six are foundations, the next four are advanced, and the last two are qualifying-exam problems.

  1. Foundations — volatility without linear return memory. Let r_t=sigma_t epsilon_t. The epsilon are centred IID, independent of the entire volatility process, with finite moments. Let X_t=log sigma_t be stationary Gaussian AR(1), variance v>0 and coefficient 0<rho<1. Find the lag-h return and absolute-return covariance.

    Solution

    For h>0, independence and E epsilon=0 give E[r_t r_(t−h)]=E[sigma_t sigma_(t−h)]E[epsilon_t epsilon_(t−h)]=0; the means are zero. Write m=E X and c_h=v rho^h. Gaussian exponential moments give E sigma=exp(m+v/2) and E[sigma_t sigma_(t−h)]=exp(2m+v+c_h). Thus Cov(sigma_t,sigma_(t−h))=exp(2m+v)(exp(c_h)−1)>0. Therefore Cov(|r_t|,|r_(t−h)|)=(E|epsilon|)^2 exp(2m+v)(exp(v rho^h)−1)>0. Positivity needs the stated rho and innovation independence; an arbitrary stochastic-volatility specification does not suffice.

  2. Foundations — the herding parameter. N=50, epsilon=0.01 and delta=0.02. Compute alpha and interpret it.

    Solution

    c=0.98/49=0.02 and alpha=epsilon/c=0.5. The beta-binomial is symmetric and endpoint-heavy; its fixed-alpha Beta limit is U-shaped. This describes the specified chain, not independent agents or an empirical investor estimate. Check the resulting up/down probabilities and remaining self-loop define a valid chain before simulation.

  3. Foundations — detailed balance. Verify the beta-binomial law for the rates above.

    Solution

    Adjacent beta-binomial masses satisfy pi(k+1)/pi(k)=(N−k)(alpha+k)/[(k+1)(alpha+N−k−1)], using the binomial and Beta-function recurrences. Dividing u(k) by d(k+1) yields exactly this ratio. Hence pi(k)u(k)=pi(k+1)d(k+1). The stated normalisation follows by summing the beta-binomial pmf. For positive rates the finite irreducible chain has this unique stationary law; self-loops satisfy balance automatically.

  4. Foundations — an isolated fill-income optimum. Noise fill intensity is lambda exp(−kd), k>0. Maximise d lambda exp(−kd) over d≥0.

    Solution

    The derivative is lambda exp(−kd)(1−kd), positive below 1/k and negative above it. Income is zero at d=0 and tends to zero at infinity, so d*=1/k is the global optimum for this isolated objective. At k=0.5 it is two ticks. Inventory, discrete actions, latent value and adverse selection alter the actual dealer problem; this derivative does not prove its optimum is two or three ticks.

  5. Foundations — what replay assumes. A two-tick tape has n fills and score R. Explain the estimate R+2n for a four-tick rule.

    Solution

    It assumes identical trade times, quantities, sides and subsequent inventory/value path, then adds two units per old fill. In the simple noise fill component, raising distance by two changes participation by exp(−2k), while informed fills and inventory also respond. Thus the fixed-fill construction does not identify the counterfactual. In the illustrated cache it is optimistic, about 445 versus 129. That sign is an observed feature here; absent further assumptions, replay bias has no universal sign.

  6. Foundations — symmetric logit Nash. Let q_i=exp((a−p_i)/mu)/(exp((a−p_1)/mu)+exp((a−p_2)/mu)+exp(a_0/mu)), with a=2,a_0=0,mu=0.25,c=1. Derive and check the symmetric first-order condition.

    Solution

    Partial q_i/partial p_i=−q_i(1−q_i)/mu. Differentiating (p_i−c)q_i gives q_i[1−(p_i−c)(1−q_i)/mu], so an interior best response satisfies p_i−c=mu/(1−q_i). At equal p≈1.472927, exp((2−p)/0.25)≈8.234 and q≈0.47136. Then 0.25/(1−q)≈0.472927=p−1. This checks the stated continuous symmetric benchmark; grid equilibria require discrete best-response comparisons.

  7. Advanced — punishment length. Let pi_c=3,pi_d=4,pi_n=2. Find the grim threshold and whether one-period Nash punishment can work for delta<1.

    Solution

    Grim gives (4−3)/(4−2)=1/2. For T=1, the incentive condition is 1≤delta(3−2)=delta, impossible for delta<1. For a general T it is 1≤sum_(j=1)^T delta^j. A feasible finite threshold requires T>1. The off-path rule must be specified, for example restarting the Nash-punishment clock on any further deviation; under the assumed ordering, this prevents gain during punishment.

  8. Advanced — half common. Under the independent unit-variance signal assumptions, solve C=1/2 for w in [0,1].

    Solution

    Equality requires Nw²=(1−w)². Taking nonnegative square roots gives sqrt(N)w=1−w, so w=1/(1+sqrt(N)). For N=100 it is 1/11≈0.09091. This is a coefficient threshold for a variance fraction; no statement about realised order-volume shares follows. Differentiating total variance gives its different minimum w=1/(N+1).

  9. Advanced — an inserted common increment. With return r=(kappa/sqrt(N)) sum_i x_i, add e to the existing common signal, holding the private components fixed. Express the added return in zero-common volatility units.

    Solution

    Aggregate flow increases by Nwe, so Delta r=kappa sqrt(N)we. At w=0, Var(r)=kappa² under independent unit-variance private signals. For kappa>0, the ratio to that standard deviation is sqrt(N)we. N=100,w=0.2,e=4 gives eight. The selected total return also contains the original common and private noise. The sign follows e; the construction supplies no event probability and is not necessarily a crash.

  10. Advanced — a positive index with zero discounting. Explain why a finite-grid learner can exceed a continuous Nash profit reference without a repeated-game equilibrium.

    Solution

    First, discretisation changes best responses and one-shot equilibria: the listed grid indices are about −0.0238 and 0.1166, so one grid equilibrium is already above the continuous reference. Second, finite learning, exploration, coupled value estimates and state visitation can prevent convergence to any equilibrium. Here about 88.5% of reported myopic sessions exceed the higher listed grid-equilibrium index. That statistic does not identify one causal mechanism. At delta=0, any frozen outcome with a profitable current deviation is not a stage-game Nash equilibrium, whatever its reported profit index.

  11. Qualifying — one-shot deviations and trigger strategies. State the assumptions, prove the principle, then derive grim and finite-punishment incentives.

    Solution

    Consider a standard perfectly monitored discounted repeated game, with |stage payoff|≤M and delta<1, and strategies defined after every history. If a continuation deviation gains epsilon>0, truncating it after T periods changes its value by at most 2M delta^T/(1−delta). Choose T to make this below epsilon, retaining a profitable finite deviation. If every one-shot deviation is unprofitable after every history, remove its last deviating date without decreasing expected payoff, including at histories reached off the original path. Repeat backwards through the finite horizon. The resulting baseline strategy cannot be strictly worse, a contradiction. Necessity follows because a one-shot deviation is itself a permitted deviation. For grim trigger, off-path repetition of static Nash is credible. On-path compliance gives pi_c/(1−delta); deviation gives at most pi_d+delta pi_n/(1−delta), yielding delta≥(pi_d−pi_c)/(pi_d−pi_n). For Nash punishment lasting T periods and restarting after any deviation, on-path payoff loss is (pi_c−pi_n)sum_(j=1)^T delta^j. Comparing it with pi_d−pi_c gives the finite condition. During punishment, a unilateral deviation cannot improve current Nash profit and restarts a weakly worse continuation. Domain consistency and public detection are essential; a visually similar learned response does not establish these constraints.

  12. Qualifying — the complete stationary law and population limit. Derive the law, prove the fixed-alpha limit and find unanimity's asymptotic probability.

    Solution

    Detailed balance gives the ratio and normalised beta-binomial pmf in problem 3. A convenient complete limit proof uses its mixture representation: draw P~Beta(alpha,alpha), then K_N|P~Binomial(N,P). Conditional variance of K_N/N is P(1−P)/N, so E[(K_N/N−P)²]≤1/(4N). Thus K_N/N converges to P in L² under this coupling, hence in distribution. This proof includes endpoint behaviour, rather than relying only on an interior Stirling approximation. For fixed alpha>0, pi(0)=B(alpha,N+alpha)/B(alpha,alpha)=Gamma(2alpha)Gamma(N+alpha)/[Gamma(alpha)Gamma(N+2alpha)]. Symmetry doubles this value for unanimity. The gamma-ratio asymptotic gives 2 Gamma(2alpha)/Gamma(alpha) N^(−alpha). In the microscopic chain, hold alpha fixed by taking epsilon=(1−delta)alpha/(N−1), with valid rates. Fixing epsilon instead would change alpha and invalidate this limit statement.

Reading and notes

The part's papers

from READING.md

  • Arthur, W. B., Holland, J., LeBaron, B., Palmer, R., Tayler, P. (1997). "Asset pricing under endogenous expectations in an artificial stock market." In The Economy as an Evolving Complex System II.
  • Lux, T., Marchesi, M. (1999). "Scaling and criticality in a stochastic multi-agent model of a financial market." Nature.
  • LeBaron, B. (2006). "Agent-based computational finance." Handbook of Computational Economics.
  • Farmer, J. D., Foley, D. (2009). "The economy needs agent-based modelling." Nature.
  • Kearns, M., Nevmyvaka, Y. (2013). "Machine learning for market microstructure and high frequency trading." In High Frequency Trading (Risk Books).
  • Kirilenko, A., Lo, A. W. (2013). "Moore's law versus Murphy's law: algorithmic trading and its discontents." JEP.
  • Byrd, D., Hybinette, M., Balch, T. (2020). "ABIDES: towards high-fidelity multi-agent market simulation." ACM SIGSIM-PADS.
  • Vyetrenko, S., et al. (2020). "Get real: realism metrics for robust limit order book market simulations." ICAIF.
  • Calvano, E., Calzolari, G., Denicolò, V., Pastorello, S. (2020). "Artificial intelligence, algorithmic pricing, and collusion." AER.
  • Gensler, G., Bailey, L. (2020). "Deep learning and financial stability." Working paper.
  • Danielsson, J., Macrae, R., Uthemann, A. (2022). "Artificial intelligence and systemic risk." J. Banking & Finance.
  • Colliard, J.-E., Foucault, T., Lovo, S. (2022). "Algorithmic pricing and liquidity in securities markets." Working paper (verify: venue).
  • Hambly, B., Xu, R., Yang, H. (2023). "Recent advances in reinforcement learning in finance." Mathematical Finance.
  • Dou, W., Goldstein, I., Ji, Y. (2024). "AI-powered trading, algorithmic collusion, and price efficiency." Working paper (verify).
  • IMF (2024). Global Financial Stability Report, October, ch. 3 (AI and capital markets); FSB (2024). The Financial Stability Implications of Artificial Intelligence.
  • Lopez-Lira, A. (2025). "Can large language models trade? Testing financial theories with LLM agents in market simulations." Working paper (verify).
  • Friedman, J. (1971). "A non-cooperative equilibrium for supergames." Review of Economic Studies.
  • Green, E., Porter, R. (1984). "Noncooperative collusion under imperfect price information." Econometrica.
  • Fudenberg, D., Maskin, E. (1986). "The folk theorem in repeated games with discounting or with incomplete information." Econometrica.
  • Abreu, D. (1988). "On the theory of infinitely repeated games with discounting." Econometrica.
  • Bikhchandani, S., Hirshleifer, D., Welch, I. (1992). "A theory of fads, fashion, custom, and cultural change as informational cascades." JPE; Banerjee, A. (1992). "A simple model of herd behavior." QJE.
  • Lakonishok, J., Shleifer, A., Vishny, R. (1992). "The impact of institutional trading on stock prices." JFE.
  • Kirman, A. (1993). "Ants, rationality, and recruitment." QJE.
  • Gode, D., Sunder, S. (1993). "Allocative efficiency of markets with zero-intelligence traders." JPE.
  • Brock, W., Hommes, C. (1998). "Heterogeneous beliefs and routes to chaos in a simple asset pricing model." JEDC.
  • Ivaldi, M., Jullien, B., Rey, P., Seabright, P., Tirole, J. (2003). The Economics of Tacit Collusion. Report for DG Competition.
  • Alfarano, S., Lux, T., Wagner, F. (2005). "Estimation of agent-based models: the case of an asymmetric herding model." Computational Economics.
  • Farmer, J. D., Patelli, P., Zovko, I. (2005). "The predictive power of zero intelligence in financial markets." PNAS.
  • Franke, R., Westerhoff, F. (2012). "Structural stochastic volatility in asset pricing dynamics: estimation and model contest." JEDC.
  • Harrington, J. (2018). "Developing competition law for collusion by autonomous artificial agents." J. Competition Law & Economics.
  • Spooner, T., Fearnley, J., Savani, R., Koukorinis, A. (2018). "Market making via reinforcement learning." AAMAS.
  • Braun-Munzinger, K., Liu, Z., Turrell, A. (2018). "An agent-based model of corporate bond trading." Quantitative Finance.
  • Levine, S., Kumar, A., Tucker, G., Fu, J. (2020). "Offline reinforcement learning: tutorial, review, and perspectives on open problems." arXiv.
  • Brown, Z., MacKay, A. (2023). "Competition in pricing algorithms." AEJ: Microeconomics.
  • Banchio, M., Mantegazza, G. (2023). "Adaptive algorithms and collusion via coupling." EC '23 (verify: venue).
  • Assad, S., Clark, R., Ershov, D., Xu, L. (2024). "Algorithmic pricing and competition: empirical evidence from the German retail gasoline market." JPE.
  • Fish, S., Gonczarowski, Y., Shorrer, R. (2024). "Algorithmic collusion by large language models." arXiv.
  • US Department of Justice (2024). United States et al. v. RealPage, Inc. (complaint; allegations).

Papers and sources

Sources and reproducibility

The displayed numerical algorithms remain in compute.py and explainer/quant/house/agents.py. Ordinary cache reads in common.py require the seven audited names and exact output hashes before the counted loader can run. Unknown, missing, changed or excluded outputs cannot trigger implicit computation. Do not rerun the once-only original dispatcher to rebuild presentation evidence.

Selected sources: Kirman (1993); Gode and Sunder (1993); Arthur et al. (1997); Brock and Hommes (1997, 1998); Lux and Marchesi (1999); Bikhchandani, Hirshleifer and Welch (1992); Franke and Westerhoff (2012); Byrd, Hybinette and Balch (2020); Vyetrenko et al. (2020); Hambly, Xu and Yang (2023); Levine et al. (2020); Calvano et al. (2020); Friedman (1971); Abreu (1988); Banchio and Mantegazza (2023). Published papers describe their own settings; these simulations are limited reproductions, not exact replications of every experiment.

Official historical sources reviewed for this revision:


Data, scope and reproducibilityMechanisms and their limits

For Kirman's chain, N>1, epsilon>0, 0≤delta<1 and valid transition probabilities are required. With c=(1-delta)/(N-1) and alpha=epsilon/c,

[ u(k)=\frac{N-k}{N}c(\alpha+k),\qquad d(k)=\frac{k}{N}c(\alpha+N-k). ]

Spontaneous switching and imitation are additive. The remaining probability is a self-loop. Detailed balance gives

[ \pi(k)=\binom Nk\frac{B(k+\alpha,N-k+\alpha)}{B(\alpha,\alpha)}. ]

At fixed alpha, k/N converges in law to Beta(alpha,alpha), and the two-endpoint mass is asymptotic to 2 Gamma(2alpha)/Gamma(alpha) times N^(-alpha). Keeping epsilon fixed is a different asymptotic regime. The exact 90→10 mean passage time is not precisely the same estimand as inspecting a path every ten steps for a crossing from at least 90 to at most 10.

The dealer's informed traders observe current latent value, not the next innovation. That innovation occurs after the trading decision. Inventory and last trade omit the mid-minus-value gap, so state aliasing matters. The score is latent-value marked P&L less an inventory penalty. The best evaluated fixed rule is a finite-grid selection, rather than an independently confirmed optimum. Fixed-fill replay estimates a different object from interactive execution because changing quotes changes fills. Sequential importance evaluation needs overlap, correctly recorded propensities and suitable identification assumptions; products of ratios can have severe variance.

The pricing index is (profit − Nash profit)/(monopoly profit − Nash profit), using the stated benchmarks. It is not the fraction of the price gap. Punishment percentages condition on the fixed-point subset; recovery of an average does not imply recovery in every session. Independent additive payoff noise is not an adverse-selection model. Simulated high prices and retaliation are coordination diagnostics, not a proof of subgame perfection or a legal conclusion. The August 2024 RealPage complaint is cited as a historical allegation, without asserting its current procedural status.

For the repeated-game theorem, assume common action domains, perfect public monitoring, bounded stage payoffs, 0≤delta<1, a collusive payoff pi_c, best current deviation payoff pi_d>pi_c, and a credible static-Nash payoff pi_n<pi_c. Grim trigger is subgame perfect iff

[ \delta\ge\frac{\pi_d-\pi_c}{\pi_d-\pi_n}. ]

For a T-period Nash punishment, specify that any deviation during punishment restarts the clock. On-path deterrence is

[ \pi_d-\pi_c\le(\pi_c-\pi_n)\sum_{j=1}^T\delta^j. ]

A threshold strictly below one exists only when T(pi_c−pi_n)>pi_d−pi_c. During punishment, Nash best response prevents a current gain and restarting delays the better continuation. The continuous logit benchmark gives grim 0.3931 and T=1,2,3,5 thresholds 0.6477, 0.4475, 0.4103, 0.3954. These do not automatically certify the fifteen-price learners.

The reported pure-grid min-best-response value 0.2041, combined with continuous collusion/deviation payoffs, produces the illustrative ratio 0.3574. This is a mixed-domain calculation, not a general Abreu bound, a mixed-action minmax calculation or an established attainable penal code. Credible continuation punishments and consistent domains require separate analysis.

For x_i=w s+(1−w)e_i, assume s,e_1,...,e_N are mutually independent, zero mean and unit variance. The orders are correlated. Then

[ V=N^2w^2+N(1-w)^2,\qquad C=\frac{Nw^2}{Nw^2+(1-w)^2}. ]

C is a variance fraction, not a realised trade fraction. V is minimised at w=1/(N+1), so it is not monotone from zero. The simulated volatility dots include an inserted shock in 5,000 observations, whereas the stationary reference uses unmodified signals. The selected shock adds +4 to an already random common signal. Under impact kappa/sqrt(N), its added return is kappa sqrt(N) w·4: eight zero-common volatility units at N=100,w=0.2. The selected day's total return also includes its baseline random components. There is still private-signal return at w=0. A flow-factor variance fraction additionally needs factor-residual orthogonality. Shared news and rebalancing can produce common flow without AI uniformity.

Chapter notesChapters
Chapter Main question and scope
Opening What do these experiments actually establish? Profit indices, interactive execution and variance shares have different meanings.
1. Artificial markets Selected switching-agent models produce tails and volatility clustering. Matching moments is descriptive; the original 81-point research grid is neither a held-out validation nor unique mechanism identification.
2. Herding Kirman's finite chain has an exact beta-binomial law. The Beta limit holds with fixed alpha, requiring the spontaneous-switching probability to scale with population. Sampled crossings differ from exact-state passage times.
3. Simulators ABIDES, response metrics and the Lucas critique. A model counterfactual is conditional on its assumptions. Objectives do not automatically establish real causal validity.
4. Learning to trade The dealer has 39 compressed observations, not a fully observed MDP. Scores include inventory penalties. Finite constant-step learning and one training seed do not establish convergence, equivalence or universal method rankings.
5. Language models Historical contamination is possible, not certain. Synthetic novelty is insufficient by itself. Prospective timing, version and trial controls remain necessary.
6. Pricing learners Fifteen prices and finite training produce supra-competitive profit indices and conditional retaliation. A 200-step recurrence cap is shorter than the 225-state space. Frozen recurrence does not certify equilibrium or legal agreement.
7. Common signals Independent unit-variance components give a common variance fraction of about 86% at N=100, w=0.2. A deliberately inserted positive signal increment illustrates amplification, not crash frequency.
8. Stability Dated 2024 IMF/FSB assessments, selected historical rules and distinct operational/liquidity episodes. Historical reports do not establish current prevalence or absence of AI instability.
9. Rule 42 Proposed stress tests and governance, rather than a completed deployment-approval system.
Research One-shot deviations, grim trigger and a specified finite punishment. Continuous-action benchmarks are distinguished from discrete learning and mixed-domain illustrative ratios.
Outro Qualifications, six desk questions and twelve fully solved problems.

Companion films in this repository

中文讲义

本讲的中文说明、交易台问题与习题解答(与英文版对应)。

导言量化金融,从零搭建 — 第42部分:市场中的机器

这是四十三部分系列的第42部分,研究交易规则、学习和共同输入如何通过市场相互作用。模拟器能证明一种机制存在,却不能单凭相似图形识别真实价格的成因。这个区别贯穿人工市场、羊群链、交易商学习者、定价博弈和共同信号群体。

唯一下载的市场输入是肯尼斯·弗伦奇截至二〇二〇年的日频研究窗口数据。其余数字来自原有固定种子模拟或代数。七项经审计的普通计算各成功调用一次,没有修改金融算法或 compute.py,没有登记新的市场试验,没有打开封存策略结果,也没有执行语言模型交易者。

Chapter notes章节与适用范围
章节 关键区别
开场 利润插值指数、交互执行与方差份额不是同一种量。
1. 人工市场 选定模型能产生厚尾和波动聚集;八十一点原始矩网格不构成样本外验证或唯一机制识别。
2. 羊群效应 精确贝塔二项平稳分布;固定阿尔法的极限要求自发切换率随人数缩放;采样越界不同于精确状态通过时间。
3. 模拟器 ABIDES、响应指标与卢卡斯批判;模型反事实依赖假设,有目标函数也不自动获得真实因果有效性。
4. 学习交易 三十九种压缩观测不是完全可观测状态;得分含库存惩罚;单个训练种子和恒定步长不证明收敛或普遍优劣。
5. 语言模型 历史污染是可能性,不是必然;合成新颖性不足以构成干净推理测试;仍需时间、版本与试验纪律。
6. 定价算法 十五价格、有限训练;惩罚比例以固定点子样本为条件;两百步搜索不足以保证发现两百二十五状态中的循环。
7. 共同信号 独立单位方差分量下,人数一百、共同系数点二给出约百分之八十六的总方差;人为正向增量不是崩盘频率。
8. 金融稳定 二〇二四年监管报告与选定历史规则;不同操作或流动性事件不能归为同一已证原因。
9. 第42条规则 建议的压力测试与治理,而非已完成的部署批准。
研究章 完美监测、统一动作域下的冷酷触发及有限惩罚;与离散学习、混合动作域的示例比率区分。
结尾 六个交易台问题和十二道完整解答习题。
Desk questions, with solutions六个交易台问题与完整解答
  1. 宽价差和被迫降价后的响应证明合谋吗? 不证明。它们提示应检查个体策略、相关历史处有利偏离、信息交换和适用法律。固定点子样本的条件惩罚比例不能支持普遍的经济或法律结论。
  2. 行情记录为什么不是新报价策略的环境? 报价改变参与率和逆向选择。每笔旧成交加两跳,固定了对手反应,并未重建宽报价会收到的成交。示例回放约445,交互模拟约129;这里的“实时”指模拟交互,不是真实资金交易。
  3. 模拟器训练的策略应面对什么? 不同环境、对手、复制品,以及干预响应指标,不只是无条件矩。还应说明隐藏状态遗漏、识别假设、独立训练变异,以及实际部署所需信息和成本协议。
  4. 切换怎样聚集波动? 完整状态下,持续的群体份额改变创新方差。只给定份额仍可能遗漏其他状态变化。这是一种可能机制,不是对真实波动的唯一识别。
  5. 小共同系数为何重要? 人数一百、权重点二时,共同方差400,私有方差64,比例400/464≈86.2%。私有分量部分分散,不精确抵消。指定冲击规则下,正四增量增加八个基准波动单位,不提供频率。
  6. 冷酷触发何时维持垄断? 在定理假设下,比较 pi_c/(1−delta) 与 pi_d+delta pi_n/(1−delta),整理得阈值;连续logit示例约0.3931。
Problems, with worked solutions十二道习题与完整解答

前六道为基础,接着四道为进阶,最后两道为资格考试题。

  1. 基础:收益无线性记忆,幅度却有。 设 r_t=sigma_t epsilon_t,epsilon 独立同分布、均值零、与整个波动过程独立,且相关矩存在。X_t=log sigma_t 是平稳高斯AR(1),均值m、方差v>0、系数0<rho<1。求h>0的两种协方差。

    解答

    E[r_t r_(t−h)]=E[sigma_t sigma_(t−h)]E[epsilon_t epsilon_(t−h)]=0,收益均值也为零。记 c_h=v rho^h,高斯指数矩给出 E sigma=exp(m+v/2),E[sigma_t sigma_(t−h)]=exp(2m+v+c_h)。因此波动协方差为 exp(2m+v)(exp(c_h)−1)>0,绝对收益协方差是它乘(E|epsilon|)²。这依赖正rho和创新独立性,不能对任意随机波动过程直接声称正相关。

  2. 基础:羊群参数。 N=50、epsilon=0.01、delta=0.02,求alpha并解释。

    解答

    c=0.98/49=0.02,alpha=epsilon/c=0.5。对称贝塔二项分布更偏两端,固定alpha的贝塔极限呈U形。这是指定链的结论,不代表独立参与者或实际投资者估计;还须确认上、下和停留概率构成有效链。

  3. 基础:细致平衡。 验证贝塔二项平稳分布。

    解答

    二项系数和贝塔函数递推给出 pi(k+1)/pi(k)=(N−k)(alpha+k)/[(k+1)(alpha+N−k−1)]。计算u(k)/d(k+1)得到同一比率,故相邻细致平衡成立。贝塔二项概率总和为一,提供归一化。有限不可约链的平稳分布唯一,停留项自动满足平衡。

  4. 基础:单独的成交收入最优值。 最大化 d lambda exp(−kd),其中d≥0、k>0。

    解答

    导数是 lambda exp(−kd)(1−kd),在1/k以下为正、以上为负。零点与无穷远收入为零,所以d*=1/k是这个独立目标的全局最优;k=0.5时为两跳。库存、离散动作、潜在价值与逆向选择会改变完整交易商问题,不能由此证明其最优为两跳或三跳。

  5. 基础:回放到底假设什么? 两跳行情有n笔成交、得分R,解释四跳估计R+2n。

    解答

    它固定时间、数量、方向,以及后续库存和价值路径,然后每笔加两单位。噪声成交分量在距离增加两跳后乘exp(−2k),知情成交与库存也会响应。因此它不识别反事实。所示缓存例子中,约445比129乐观;这是该例结果,没有额外假设时,回放偏差方向并非普遍固定。

  6. 基础:对称logit纳什。 取a=2、a_0=0、mu=0.25、c=1,推导并检查连续对称一阶条件。

    解答

    q_i为正文logit份额,有偏导 dq_i/dp_i=−q_i(1−q_i)/mu。利润(p_i−c)q_i的导数为 q_i[1−(p_i−c)(1−q_i)/mu],内点条件是p_i−c=mu/(1−q_i)。对称p≈1.472927时,exp((2−p)/0.25)约8.234,q约0.47136,0.25/(1−q)约0.472927,等于p−1。这验证连续基准;网格均衡需要离散最佳响应比较。

  7. 进阶:惩罚长度。 pi_c=3、pi_d=4、pi_n=2,求冷酷阈值与一期惩罚可行性。

    解答

    冷酷阈值(4−3)/(4−2)=1/2。T=1时要求1≤delta,对delta<1不可能。一般T要求1≤sum_(j=1)^T delta^j;小于一的有限阈值要求T>1。还须规定路径外规则,例如再次偏离就重启纳什惩罚时钟;在给定收益排序下,这阻止惩罚期间获利。

  8. 进阶:一半方差共同。 在独立单位方差信号假设下解共同份额为二分之一。

    解答

    Nw²=(1−w)²,非负平方根给出sqrt(N)w=1−w,所以w=1/(1+sqrt(N))。N=100时为1/11≈0.09091。这是方差份额的系数阈值,不是已实现成交量比例。总方差求导得到另一个位置:最小值在1/(N+1)。

  9. 进阶:共同信号增量。 收益为(kappa/sqrt(N))sum_i x_i,在已有共同信号上加e、固定私有信号,以零共同波动为单位求增量。

    解答

    总订单增加Nwe,收益增加kappa sqrt(N)we。w=0时收益方差kappa²;kappa>0时标准化增量为sqrt(N)we。N=100、w=0.2、e=4得到八。所选日总收益还含原共同与私有噪声;符号随e,不提供事件概率,也不必是崩盘。

  10. 进阶:零折扣为何也可有正指数? 解释有限网格学习者高于连续纳什参考,却不构成重复博弈均衡。

    解答

    第一,离散化改变最佳响应和单期均衡;列出网格指数约−0.0238和0.1166,其中一个已高于连续参考。第二,有限学习、探索、耦合估计和访问分布可能阻碍到达任何均衡。这里约88.5%的短视场次指数高于较高网格均衡,统计本身不识别原因。delta=0时,只要有利的当前偏离存在,冻结结果就不是单期纳什,无论利润指数多高。

  11. 资格考试:单次偏离与触发策略。 说明假设、证明原则并推导两类激励条件。

    解答

    标准完美监测折扣重复博弈中,各期收益绝对值≤M、delta<1,策略定义于每个历史。若某延续偏离获益epsilon>0,T期后截断的收益变化≤2M delta^T/(1−delta),选足够大T保留正收益。若任何历史处单次偏离都不盈利,就能不降低期望收益地删除最后一个偏离日期,包括原路径外历史,再向前删除全部有限偏离,得到矛盾。必要性直接来自单次偏离也是合法偏离。冷酷策略路径外重复静态纳什可信;路径上比较pi_c/(1−delta)与pi_d+delta pi_n/(1−delta),整理得阈值。T期惩罚且再次偏离重启时,合作路径损失为(pi_c−pi_n)sum_(j=1)^T delta^j,需不小于pi_d−pi_c。惩罚中当前纳什利润无法单独提高,重启又延迟更优延续。动作域一致和公开检测十分关键,学习响应外观相似不验证这些约束。

  12. 资格考试:完整平稳律与人口极限。 推导分布,证明固定alpha极限与完全一致概率。

    解答

    第三题细致平衡给出归一化贝塔二项分布。完整极限证明可用混合表示:先抽P~Beta(alpha,alpha),再令K_N|P~Binomial(N,P)。条件方差为P(1−P)/N,故E[(K_N/N−P)²]≤1/(4N),在该耦合下均方收敛,从而分布收敛。这个证明包含边界行为,不只依赖内点斯特林近似。固定alpha>0时,pi(0)=Gamma(2alpha)Gamma(N+alpha)/[Gamma(alpha)Gamma(N+2alpha)],对称性让完全一致概率加倍。伽马比渐近给出2Gamma(2alpha)/Gamma(alpha)·N^(−alpha)。微观链中需取epsilon=(1−delta)alpha/(N−1),并保证概率有效;若固定epsilon,alpha会变,不能使用这个固定参数极限。

Papers and sources来源与复现

金融算法保留原样。common.py只允许七个经审计名称及其精确缓存哈希;未知、缺失、更改或排除项目在路径或计数访问前被阻止,不会隐式计算。不要再次运行已完成的一次性原始计算调度器来重建演示。

上方英文来源区给出论文和官方历史链接。二〇二四年IMF、FSB报告是当时潜在脆弱性与数据缺口的评估;欧盟规则适用范围、人工智能法的分阶段实施与美国具体市场准入义务需分别分析。SEC二〇一三年Knight报告描述部署路由故障及超过四亿六千万美元损失,不是所有事件都属流动性撤走。二〇一四年国债十二分钟事件的“没有明显新公开催化信息”只针对该窗口。二〇二五年预测分析提案撤回,不等于其他责任消失。以上是教学历史材料,不是当前完整法律意见。

Review log of the earlier QA passes on this part: docs/qa/quant/part42.md.

Data, scope and reproducibility机制、公式与限制

柯曼链要求 N>1、epsilon>0、0≤delta<1,且转移概率有效。记 c=(1−delta)/(N−1)、alpha=epsilon/c,则

[ u(k)=\frac{N-k}{N}c(\alpha+k),\quad d(k)=\frac{k}{N}c(\alpha+N-k). ]

自发切换与模仿是相加的,余下概率是停留。细致平衡得到

[ \pi(k)=\binom Nk B(k+\alpha,N-k+\alpha)/B(\alpha,\alpha). ]

固定 alpha 时,份额收敛到 Beta(alpha,alpha),完全一致概率渐近为 2Gamma(2alpha)/Gamma(alpha)·N^(−alpha)。这需要 epsilon 随 N−1 的倒数缩放。固定 epsilon 是另一种极限。每十步检查“至少九十到不超过十”的采样通过时间,包含延迟与越界,不等于精确九十到十的理论量。

交易商中的知情者看到当前潜在价值,不知道下一次创新;创新发生在交易决策后。库存和上一笔方向遗漏中价与价值的缺口,因此有隐藏状态混叠。得分是潜在价值计价损益减库存惩罚,不只是现金利润。最佳测试固定规则是有限网格选择,不是独立确认的全局最优。沿用固定成交记录不能重现新报价下的成交。序贯重要性评估需要重叠、可靠倾向概率和适当识别假设;概率比连乘可能方差极大。

定价指数是“利润减纳什利润”除以“垄断利润减纳什利润”,不是价格差距百分比。惩罚比例以固定点子样本为条件;均值恢复不代表每场恢复。独立加性利润噪声不是逆向选择。高价与报复是协调诊断,不证明子博弈完美均衡或法律协议。二〇二四年八月RealPage起诉仅作为当时的指控引用,不说明案件当前程序状态。

重复博弈定理假设统一动作域、完美公开监测、有界收益、0≤delta<1,且 pi_d>pi_c>pi_n,静态纳什惩罚可信。冷酷触发成立当且仅当

[ \delta\ge(\pi_d-\pi_c)/(\pi_d-\pi_n). ]

有限T期纳什惩罚必须规定:惩罚中再次偏离就重新计时。合作路径的条件为

[ \pi_d-\pi_c\le(\pi_c-\pi_n)\sum_{j=1}^{T}\delta^j. ]

存在严格小于一的阈值,需要 T(pi_c−pi_n)>pi_d−pi_c。惩罚期里,纳什最佳响应阻止当前收益提高,重启又推迟较好的延续。连续logit基准的冷酷阈值约0.3931;T为1、2、3、5时分别为0.6477、0.4475、0.4103、0.3954。这些数不自动认证十五价格学习者。

纯网格“最小最佳响应”值0.2041,与连续合作和偏离利润组合,得到示例比率0.3574。动作域混合,因此它不是一般阿布鲁界、混合动作最小最大值,也不是已证明可达到的惩罚机制。可信延续与一致动作域须另外分析。

共同信号模型 x_i=w s+(1−w)e_i 中,信号分量相互独立、均值零、方差一;订单本身相关。总方差为 N²w²+N(1−w)²,共同方差份额为 Nw²/[Nw²+(1−w)²]。这不是实际成交份额。总方差在 w=1/(N+1) 最小,并非从零起单调增加。模拟五千观测中含一次人为冲击,理论线则使用未改动的信号。所选日是在已有随机共同信号上加正四;在 kappa/sqrt(N) 冲击规则下,额外收益为 kappa sqrt(N)w·4。人数一百、权重点二时为八个零共同基准波动单位。总收益还包括原随机分量;w=0时也有私有订单收益。订单流因子份额还需因子与残差正交,共享新闻或再平衡也能造成共同变化,不能直接归因人工智能。

Build the film

python -m videos.quant.quant42.compute      # the part's numbers, into .cache/quant42
python tools/make.py quant42                # the narrated film, English and Chinese
EXPLAINER_TTS=silent python tools/qa_scene.py quant42 Hook   # one chapter, silent, with a contact sheet

Scenes: videos/quant/quant42. Setup: see the course page. Source of these notes: the part's README and the scenes' narration.