Skip to content
All library documents

Fixed-Price Spot Trading Loop with Alternating Buy and Sell Orders

Article Strategy library · Author: 小草

Summary

This spot strategy repeatedly places a buy limit order at a preset price, then places a sell limit order after the buy fills. Once the sell fills, it returns to the buy stage, creating a simple two-price trading loop. The parameters include the buy and sell prices, order quantity, polling interval, and profit reporting interval. The published configuration uses BTC/USDT on Binance and gives a backtest date range, but does not report returns or other results.

The implementation tracks account balances, open orders, and order fills, and cancels existing orders at startup and exit. It checks that the selected exchange is spot and retains the configured symbol. The method depends on price moving between the two chosen levels and does not describe how to select or update those levels. It also requires sufficient quote currency to buy and sufficient asset inventory to sell; fees, slippage, unfilled orders, and adverse price movement can affect the outcome. Repeated execution alone does not establish that the loop will be profitable.

Key ideas

  • The strategy alternates a preset buy limit order and a preset sell limit order after each fill.
  • The cycle restarts with a buy after the sell completes.
  • Order size and the two price levels are user configured, with optional polling and profit logging intervals.
  • The implementation monitors balances and order status and cancels outstanding orders during startup and exit.
  • The example gives a spot-market backtest setup but provides no performance results or method for choosing the price levels.

Tags

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