Iceberg Buying by Repeatedly Placing and Cancelling Small Orders
Summary
This introductory example shows how to accumulate a target amount using repeated small buy orders. It records the starting asset balance, checks the acquired amount on each loop, and submits an order at the current ticker’s ask price while the remaining quantity exceeds the chosen order size. After a fixed wait, it attempts to cancel the order, then repeats. When the target is nearly reached, it calculates average cost from the balance and asset changes, including fees.
The parameters specify a target buy amount, an iceberg order size, and an order lifetime in seconds; the example defaults are 2, 0.1, and 3. The stated purpose is to reduce market impact by splitting a larger purchase into smaller orders. It is a basic learning example, not a tested execution model: it provides no market impact or fill-rate measurements and does not discuss partial fills, order book depth, exchange-specific behavior, or handling for balance and division edge cases.
Key ideas
- The example divides a target purchase into repeated orders of a configurable smaller size.
- It submits each buy at the current ask and waits a configured number of seconds before attempting cancellation.
- It tracks acquired quantity against the initial asset balance and estimates average cost from balance changes, including fees.
- The example is presented for learning and does not provide evidence about market impact or execution quality.
- Partial fills, exchange behavior, and calculation edge cases may affect practical use.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.