Skip to content
All library documents

A One-Sided Buy Grid That Sells Filled Orders at a Price Increment

Article Strategy library · Author: 6821281

Summary

This script implements a basic one-sided grid for a spot-style exchange interface. It places a limit buy below the current price, or below a user-specified starting price, using a configured price interval. The buy size is calculated as a percentage of the account balance divided by the order price, and a minimum quantity check determines whether an order is submitted. After a buy is detected as filled, the script submits a sell at the fill price plus a configured increment. It repeats the process on a timer.

The document provides parameters but no backtest or performance evidence. The implementation has important limitations: it cancels existing buy orders during each cycle, while its fill-detection logic relies on trade history and indexes records without checking that each entry exists. It also does not describe inventory limits, fees, adverse price movement, or what happens when sells remain unfilled. The brief accompanying note gives a starting-price testing hint, not evidence of profitability or safe operation.

Key ideas

  • The script places a buy order below the market or a configured starting price.
  • Order quantity is based on a percentage of account balance and a minimum-size threshold.
  • A detected buy fill triggers a sell order at a configured increment above the purchase price.
  • The loop cancels existing buy orders before placing another, which can affect grid continuity.
  • No backtest, cost analysis, or inventory risk controls are provided.

Tags

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