Inventory Rebalancing with Spread-Based Market-Making Orders
Summary
This script attempts to rebalance a coin-and-fiat account by comparing the value of the coin holdings at spread-adjusted bid and ask prices with the fiat balance. When holdings appear overweight relative to fiat, it submits a sell order; when fiat appears overweight, it submits a buy order. The trade size is based on half the value imbalance, converted into coin units, then rounded to the configured quantity increment and checked against a minimum size.
The loop manages outstanding orders by keeping two, canceling excess orders, and conditionally replacing a lone order as prices move. A configurable delay controls how often it refreshes account and order-book data, while the spread parameter sets the order-price offset. The script also periodically logs an estimated profit measure. It provides implementation details but no test results, and the estimate and rebalancing behavior depend on exchange order handling, fees, fills, and the quality of the account and depth data.
Key ideas
- The strategy estimates inventory imbalance using spread-adjusted prices and the fiat balance.
- It trades toward balance by sizing buys or sells at half the calculated value gap.
- Order sizes are rounded to a configured increment and must exceed a minimum quantity.
- Open orders are monitored and canceled or replaced as the market moves.
- The script logs a periodic profit estimate but provides no evidence of profitability after trading costs.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.