Canceling Active Market-Making Orders Below a Minimum Spread
Summary
Hummingbot’s minimum-spread setting cancels an active order when its spread relative to the mid-price falls below a chosen threshold. The strategy checks the spread once per second, allowing it to remove an order before the normal refresh interval if market movement makes that order too close to the mid-price.
The setting is disabled by default through a negative value and can be enabled by configuring a minimum spread. The example shows a sell order being canceled after its spread falls below the configured level, while a buy order remains active; fresh orders are placed at the next refresh. The feature applies to active orders and does not affect hanging orders. The documentation describes order-management behavior, not a profitability test, and the appropriate threshold depends on the strategy and market conditions.
Key ideas
- The setting cancels active orders whose spread drops below a configured minimum.
- The bot checks active-order spreads every second, independently of the regular refresh interval.
- A negative default value disables the feature.
- Hanging orders are outside the setting’s scope, and no performance evidence is provided.
Tags
Full text
# Minimum Spread
# Minimum Spread
**Released on version [0.28.0](../../../release-notes/index.md)**
This parameter allows Hummingbot to cancel the active order right away when its spread dips below the specified value.
## `minimum_spread`
If the spread of any active order falls below this param value, it will be automatically canceled.
** Prompt: **
```json
At what minimum spread should the bot automatically cancel orders?
>>>
```
## How it works
The strategy checks the active order's spread on every tick (1 second).
By default, this is set to `-100`. Setting this parameter to a negative value disables this feature. To enable, run the `config minimum_spread` command in the Hummingbot client and specify your minimum spread value.
This only applies to active orders and does not affect hanging orders.
## Sample configuration
```json
- bid_spread : 0.50
- ask_spread : 0.50
- minimum_spread : 0.49
- order_refresh_time : 60.0
```
With the above configuration, the bot creates buy and sell orders at 0.5% spread from mid-price.
```
00:28:31 - Creating 1 bid orders at (Size, Price): ['0.05 ETH, 227.41USDC']
00:28:31 - Creating 1 ask orders at (Size, Price): ['0.05 ETH, 229.69USDC']
00:28:31 - Created LIMIT_MAKER BUY order x-XEKWYICX-BEHUC1593217711001924 for 0.05000000 ETHUSDC.
00:28:31 - Created LIMIT_MAKER SELL order x-XEKWYICX-SEHUC1593217711002203 for 0.05000000 ETHUSDC.
```
```
Orders:
Level Type Price Spread Amount (Orig) Amount (Adj) Age
1 sell 229.69 0.49% 0.05 0.05 00:00:00
1 buy 227.41 0.50% 0.05 0.05 00:00:00
```
Even before the 60 seconds refresh time was up, the sell order was canceled when its spread went below the minimum.
```
00:28:40 - Order is below minimum spread (0.0049). Cancelling Order: (Sell) ID - x-XEKWYICX-SEHUC1593217711002203
00:28:40 - Cancelling the limit order x-XEKWYICX-SEHUC1593217711002203.
```
```
Orders:
Level Type Price Spread Amount (Orig) Amount (Adj) Age
1 buy 227.41 0.52% 0.05 0.05 00:00:12
```
In the next order refresh, new buy and sell orders with 0.5% spreads will be created.Shown in full with attribution under the source's licence. Licence: Apache-2.0
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.