Building a Fixed-Grid Crypto Strategy with Order-State Tracking
Summary
This tutorial describes a Python grid strategy for a cryptocurrency price range. It divides the range into fixed price levels, places a buy order when the market is between adjacent levels, and, after a buy fills, places a sell order above the entry to seek a preset price difference. A maintained grid structure records each level’s price, size, order identifier, and state. The loop compares that state with the exchange’s open orders to detect fills, update levels, and submit the next order. Status tables display grid levels, errors, and live orders.
The document includes a backtest configuration and code, but the provided text gives no readable performance figures or analysis of results. The strategy assumes prices will continue oscillating within the chosen range; a sustained move beyond it can leave inventory and substantial unrealized losses. Orders are left open even when prices move away, which may catch sharp price spikes but also creates execution and exposure risks. The example is presented as a programming reference, not as evidence of live profitability, and parameters, order limits, fees, and failure handling would need careful review.
Key ideas
- A fixed grid places buy orders at predefined price levels and seeks to close them at higher prices.
- The strategy tracks each grid level and compares its stored state with the exchange’s open orders.
- A filled buy changes the level to a sell order targeting a preset profit difference.
- The design leaves orders active as prices move, aiming to retain the chance of fills during sharp moves.
- The strategy depends on range-bound prices and can accumulate significant losses if price leaves the grid range.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.