Examples#

This gallery walks through every public feature of financialkit.market_microstructure: spread measures and estimators, trade classification, dealer and market-making models, asymmetric information and informed-trading measures, optimal execution and illiquidity.

Each script in this gallery is self-contained and can be run directly with python examples/market_microstructure/<section>/<script>.py.

Sections#

  • spreads – Demsetz’s spreads, Roll’s estimator, Lee-Ready trade classification and the Corwin-Schultz high-low estimator.

  • dealers – Garman’s Poisson dealer, Ho-Stoll inventory quotes and Avellaneda-Stoikov market making.

  • information – Kyle’s insider, Glosten-Milgrom, Hasbrouck’s trade-impact VAR, PIN and VPIN.

  • execution – the square-root impact law, Bertsimas-Lo and Almgren-Chriss.

  • liquidity – Amihud’s illiquidity ratio.

Dealers#

Market makers who manage order flow, inventory and risk.

Garman’s order-flow dealer

Garman's order-flow dealer

Ho and Stoll: the dealer’s inventory problem

Ho and Stoll: the dealer's inventory problem

Avellaneda and Stoikov: market making in a limit order book

Avellaneda and Stoikov: market making in a limit order book

Execution#

The cost of trading a large order, and how to schedule it.

The square-root impact law

The square-root impact law

Bertsimas and Lo: optimal control of execution costs

Bertsimas and Lo: optimal control of execution costs

Almgren and Chriss: the efficient frontier of execution

Almgren and Chriss: the efficient frontier of execution

Information#

How informed traders move prices, and how to measure their presence.

Kyle’s insider and the price impact lambda

Kyle's insider and the price impact lambda

Glosten and Milgrom: a spread from adverse selection alone

Glosten and Milgrom: a spread from adverse selection alone

Hasbrouck’s trade-impact VAR

Hasbrouck's trade-impact VAR

Easley, Kiefer, O’Hara and Paperman: the probability of informed trading

Easley, Kiefer, O'Hara and Paperman: the probability of informed trading

VPIN: flow toxicity in volume time

VPIN: flow toxicity in volume time

Liquidity#

Illiquidity measured from daily returns and volume.

Amihud’s illiquidity ratio

Amihud's illiquidity ratio

Spreads#

The price of immediacy, measured from quotes, from trades, and from prices alone.

Demsetz: the bid-ask spread as the price of immediacy

Demsetz: the bid-ask spread as the price of immediacy

Roll’s spread estimator

Roll's spread estimator

Lee and Ready’s trade classification

Lee and Ready's trade classification

Corwin and Schultz’s high-low spread estimator

Corwin and Schultz's high-low spread estimator

Gallery generated by Sphinx-Gallery