Code

Replication packages and research software for working papers. Each bundle is kept close to the corresponding paper and includes the scripts needed to reproduce the reported numerical claims.

Order Flow, Liquidation Risk, and Margin

Earlier-version code archive | Python | 2026

The current paper is Order Flow, Liquidation Risk, and Margin (V20). The code below accompanies an earlier version, Public Inference and Funding Fragility. It is retained as a historical archive, not as a replication package for V20.

Run locally with:

pip install -r requirements.txt
python code/run_all.py
  • wedge_equilibrium.py: wedge equilibrium identities and tradeoff checks.
  • iso_dispersion_path.py: iso-dispersion primitive path.
  • constructed_equilibrium.py: binding equilibrium, table values, and threshold.
  • welfare.py: constrained-efficient margin sensitivity calculations.