Skip to main content
Ido AvitalAI Engineer · Data Scientist
Menu

Data science & ML

Market Making Under Constraints

Stochastic control and optimal quoting

Optimal quoting for a market maker carrying inventory risk: two stochastic-control problems, each solved and cross-checked by independent methods.

Key result All 54 verification tests pass on an independent rerun, and a published textbook figure is reproduced exactly once two documented corrections are made.

Research study Status: Completed Academic · team of 2

Control problem HJB toODE system Three solvers MonteCarlo check

Workflow diagram

How each result is cross-checked Drawn for this site from the README and the report's structure. The project's own figures are not shown until the co-author agrees.

Research question

A market maker chooses how far from the mid-price to quote while carrying inventory risk. The project solves two such problems, continuous quote depth and quoting at the touch, and asks how much each simplification costs.

My Role & Leadership

Project Owner · Technical Lead · Developer. Owned the project and led its technical direction with one co-author, and worked hands-on in its development.

  • Led the solution approach: each control problem reduced to ordinary differential equations solved backwards in time, with closed forms, numerical integration and Monte Carlo simulation checking one another.
  • Set the verification discipline: three independent methods for the touch problem, common random numbers across strategies, 54 tests and one master seed.

Key findings

What the quote constraint changes As reported by the project
States where the constraint binds
22%
Value overstated when it is ignored
1.1%

Source: Project report, problem 7, at the report's realistic parameters.

A published textbook figure (Cartea, Jaimungal and Penalva, Figure 10.5) is replicated exactly once a missing sign and the reading of one penalty parameter are corrected, both documented.

Evaluation

Verification tests
54 of 54 passing
Dataset: The project's own test suite, rerun independently of the authors
Measured

Method

Each control problem reduces to a system of ordinary differential equations solved backwards in time; closed forms, numerical integration and Monte Carlo simulation check one another.

  1. Write each control problem as a Hamilton-Jacobi-Bellman equation and reduce it to a system of ordinary differential equations in time.

  2. Solve each system backwards in time: in closed form where one exists, and numerically everywhere.

  3. Simulate the resulting strategies on the same order flow and check the simulated value against the solved value.

  4. Compare against the textbook's published figure, and document every difference until the replication is exact.

What the team built

  • Solvers for the touch problem by three independent methods, with the switching boundary and an exact event simulator.
  • The depth problem with the non-negativity constraint on quotes, which the lecture notes omit, and its constrained Hamiltonian.
  • A common-random-number simulator that runs several strategies on one realisation of the order flow.
  • 54 verification tests and a single master seed, so every figure and table rebuilds bit for bit.

Methodological choices

  • Three independent solution methods for the touch problem, so a bug in one shows up as a disagreement with the other two.
  • Common random numbers across strategies, so differences between strategies are not simulation noise.
  • The quote constraint the lecture notes leave out was found because a Monte Carlo check disagreed with the solved value.
  • One master seed for the whole project, so every figure and table rebuilds bit for bit.

Built on

  • The model setting and the reference results come from the textbook by Cartea, Jaimungal and Penalva and the course notes.
  • An earlier course library by the same two authors is reused unchanged.

Limitations

A model study, not a trading system: the values are model value functions, not realised profit, and no market data or live trading is involved.

Key technologies

  • Python
  • NumPy
  • SciPy
  • Stochastic optimal control
  • Hamilton-Jacobi-Bellman ODEs
  • Monte Carlo
  • pytest
  • LaTeX

Evidence

  • The project's report, code, tables and test suite.
  • The 54 tests were rerun independently for this site; the figures and the report were not rebuilt.
All projects

Questions about Market Making Under Constraints