Skip to content

robertgcsmith/mm-lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Market making lab

This repository contains a collection of research-oriented toy models and experiments for exploring market making, probabilistic forecasting, and stochastic modelling in market environments.

The project is designed as an experimental lab rather than a production trading system. Its underlying assumption is that markets should be treated as stochastic systems, with an emphasis on building modelling intuition around uncertainty, noisy observations, latent regimes, and time series dynamics.

The models also focus on practical market making concerns such as order placement, execution quality, inventory risk, transaction costs, markouts, and PnL attribution.

Project Overview

The project currently explores two related modelling tracks:

1. Market Making Simulation

The market making component studies how a simple quoting strategy performs when trading around an evolving fair value.

The model tracks:

  • Bid and ask quote placement
  • Trade executions
  • Inventory accumulation
  • Realised and unrealised PnL
  • Transaction costs
  • Spread capture
  • Markout effects
  • Inventory mark-to-market impact

A key focus so far has been decomposing total PnL into interpretable components, including execution PnL, fair value spread capture, adverse selection, trading costs, and inventory-related gains or losses.

This helps distinguish whether the strategy is profitable because it is genuinely capturing spread, taking directional inventory risk, or simply benefiting from favourable price moves.

2. Hidden Regime Modelling

A key focus is time series analysis and forecasting, including the shortcomings of standard approaches, in markets where outcomes are generated by an unobserved hidden state.

For example, the lab explores how observed outcomes can be used to update posterior beliefs over possible regimes. These posterior probabilities are then used to form expected values, forecasts, and market-implied prices.

This part of the project is intended to build intuition around:

  • Bayesian updating and other filtering techniques, such as Kalman filters and hidden Markov models
  • Hidden state inference
  • Regime uncertainty
  • Forecast calibration
  • Market pricing under incomplete information
  • The difference between true latent states and inferred probabilities

Future Focus

Future development will focus on making the models more realistic, robust, and analytically useful.

Planned areas of work include:

  • Improving the market making strategy logic
  • Adding stronger inventory risk controls
  • Testing different quote widths and skewing rules
  • Introducing more realistic order arrival dynamics
  • Comparing passive and aggressive execution
  • Expanding transaction cost and latency assumptions
  • Improving posterior smoothing for hidden regime inference
  • Studying strategy performance under sudden regime shifts
  • Adding parameter sweeps and scenario testing
  • Building clearer dashboards for diagnostics and interpretation
  • Exploring novel and cutting-edge approaches to filtering

Longer term, the project may be extended to compare multiple market making agents, test reinforcement learning approaches, or introduce more realistic limit order book mechanics.

Purpose

This repository is intended for educational and research purposes.

The goal is not to build a live trading system, but to create a controlled environment for understanding the mechanics of market making and probabilistic trading models.

The project is especially useful for exploring questions such as:

  • How does inventory risk affect market making PnL?
  • When does spread capture fail to compensate for adverse selection?
  • How should a strategy react to noisy signals?
  • How quickly should posterior beliefs update after new observations?
  • What does a profitable strategy look like after accounting for costs and markouts?

Repository Status

This project is actively evolving. The current codebase should be viewed as an experimental research notebook and simulation framework.

About

Market making lab for experimentation

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors