Fund each market on its own
Create a vault for each market you quote and deposit its base and quote tokens. That balance backs only that market, so size each pair for the risk you want on it. Orders are promises, not transfers, and the program will not let one side of a book promise more than that market’s vault holds.Lay out your levels around the mid
Place orders as offsets in ticks from your mid: tight levels close in, wider levels further out. Each side has a fixed number of slots, so use them on the levels that matter most.Reprice with the mid, not with cancels
When the market moves, callupdate_mid instead of cancelling and replacing.
One call moves every resting order.
- Give every call a sequence number higher than the last, for example a timestamp. A late call with an older number is rejected, so your book never rolls back to an old price.
- Only send an update when your mid has moved by at least a tick.
- Keep a small priority fee on updates so they land quickly when the market is busy.
Put a safety net under your quotes
- Expiry. Give orders an expiry time so a quote stops filling on its own if your bot goes quiet. Expired orders still hold their slot until you cancel them, so clear them out from time to time.
- Flow protection. Turn on the same-slot flow curve so a burst of taker flow against one side pays a rising price until you reprice.
- Inventory protection. Set a target balance so the side that would push your inventory further from target gets more expensive, while the other side stays untouched.
update_market_params, without emptying your book.

