Python Iceberg Orders for Gradual Buying and Selling
Summary
The document presents a Python port of an iceberg execution strategy for gradually buying or selling a target amount. It splits a larger order into smaller orders near a configurable distance from the best bid or ask, varies each order's size randomly around an average, and tracks account balances or inventory to measure progress. If the market moves sufficiently away from the resting order, the strategy cancels pending orders and recalculates; it also checks minimum order sizes and available funds or holdings.
The examples include separate buy and sell flows and describe a simulated exchange run, but provide no execution-quality statistics or evidence of reduced market impact. The approach depends on periodic polling, exchange order behavior, and user-selected parameters such as price depth, order size, and loop interval. It is an execution tool rather than a signal strategy, and the simplified examples are intended as starting points for customization, not proof of suitability for live trading.
Key ideas
- An iceberg execution approach breaks a target trade into smaller orders to reduce the visibility of a large order.
- The strategy places orders relative to the current best bid or ask and cancels them when price displacement exceeds a threshold.
- Randomizing child-order sizes and tracking account changes help manage progress toward a buy or sell target.
- Minimum trade sizes, available balances or inventory, and polling intervals constrain order placement.
- The examples lack quantified execution results and require exchange-specific adaptation.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.