Managing Price Levels and Orders in a Grid Trading System
Summary
This document describes a Python utility for creating and managing grid levels and associating them with order identifiers. It supports arithmetic grids specified by a level count and geometric grids specified by a percentage interval. The manager can also load existing grid data, including bounds, side, grid type, and stored order references.
Functions locate nearby buy and sell levels, set an initial position through a callback, place neighboring grid orders after an order is identified, and cancel orders through another callback. A change callback can receive updated grid state. The example demonstrates initialization and callback registration, but provides no market results or performance evaluation. The source has operational limitations: boundary handling in order placement may fail, and the grid generation and lookup behavior depend on level ordering and bounds. The document explains plumbing for implementing grid trading rather than a tested trading strategy.
Key ideas
- The manager creates arithmetic grids from a level count or geometric grids from a percentage interval.
- Grid state maps price levels to order identifiers and can be restored from supplied data.
- Callbacks handle initial positioning, placing neighboring orders, cancellation, and state changes.
- The example demonstrates order-management mechanics but provides no evidence of trading performance.
- Order placement near grid boundaries may fail, so implementations need careful validation.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.