Backtesting and Tuning Parameters for Perpetual-Futures Grid Strategies
Summary
The article presents a Python workflow for collecting perpetual-futures candlesticks, simulating a grid strategy, and examining how its parameters affect results. The grid logic buys after price falls below a calculated level and sells after it rises above another. The example uses DYDX historical data and illustrates how the chosen reference price shapes initial inventory, exposure, drawdown, and reported profit. A different reference price improves the example's outcome but begins with a substantial short position, highlighting the risk of relying on a favorable starting assumption.
It also compares grid spacing and trade value, noting that tighter grids trade more often but can incur greater fees and accumulate different exposure. The author cautions that the simulation allows only one trade per candle, so it misses intrabar activity and does not reliably capture fine grid spacing; tick-level data is presented as more informative. The discussion favors long-only grids for selected assets and proposes a moving reference-price rule, while acknowledging that this increases inventory risk if prices fall. Historical backtest results are illustrative and do not establish future performance.
Key ideas
- A grid backtest needs historical data, an account and fee model, order rules, and parameter comparisons.
- The reference price affects initial positions and can materially change simulated exposure and results.
- Reducing grid spacing can increase trading frequency and fees while changing total inventory risk.
- A one-trade-per-candle simulation can miss intrabar fills and misrepresent narrow grids.
- Long-only positioning and an adjustable reference price are proposed risk choices, but falling prices can still create substantial exposure.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.