Skip to content
All library documents

Inventory-Skewed Limit-Order Grid Trading

Code Stratmill research code

Summary

The code describes a grid market-making approach that repeatedly places buy and sell limit orders around a forecast mid-price. The forecast is simply the current best bid and ask midpoint, with no alpha adjustment in this implementation. A relative half-spread sets quote distance, while a relative grid interval and a tick-size-based minimum step determine the spacing between grid levels. Orders are updated as the market changes: cancellable quotes outside the new grid are withdrawn, and missing levels are submitted as post-only orders.

Inventory affects the two sides asymmetrically. As position rises relative to order quantity, the bid moves farther away and the ask closer; maximum position thresholds prevent adding more exposure on a side. The loop skips incomplete order books and records state periodically. These mechanics illustrate quote placement, grid maintenance, and inventory control, but the code provides no trading results or profitability evidence. Its performance would depend on fees, fills, adverse selection, instrument behavior, and the chosen parameters, none of which are evaluated here.

Key ideas

  • The strategy anchors its quote grid to the midpoint of the best bid and ask.
  • Inventory skew changes bid and ask distances to encourage position reduction.
  • A minimum grid step rounds spacing to stable increments tied to tick size.
  • Position limits suppress new orders that would add exposure beyond the configured threshold.
  • The code periodically records state and replaces cancellable orders that no longer fit the grid.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.