Bitcoin Forum
August 07, 2026, 08:39:19 AM *
News: COLDCARD users only: critical vulnerability risks funds stored on COLDCARD devices; immediate action required
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Algorithm for MM bots: Ladder + Spread Shift to protect balances - thoughts?  (Read 35 times)
batonidze (OP)
Newbie
*
Offline

Activity: 63
Merit: 0


View Profile
August 06, 2026, 01:15:39 PM
 #1

Hey all,

I've been developing a custom market-making bot in Node.js and recently I've been experimenting with different liquidity modules. I wanted to share an approach I call the "Ladder + Shift" (or Spread Shift liquidity) and see how others are tackling this.

The core challenge for any MM bot is obvious: maintaining a healthy, thick order book and keeping the spread tight, without getting your balances completely drained during strong one-sided market movements (pumps or dumps).

Here's a breakdown of the algorithm I've been refining:
Instead of just blindly replacing orders at a fixed percentage from the mid-price, the bot tracks an "index" for the order ladder. When orders are filled on one side (let's say buys are filled), the module applies a "shift".

Depending on the fill volume, we recalculate the spread using the VWAP of the filled orders. Then, we apply a dynamic factor like a Buy Price Adjustment (BPA) and Sell Price Adjustment (SPA).
For instance, if the standard order step is 5%, after a significant fill, the shift might trigger an additional 10% SPA. So the new orders on the opposite side are placed at Step (5%) + SPA (10%), aggressively widening the gap and preventing the bot from getting steamrolled by momentum.

In most normal or slow-ranging market conditions, this method works decently well. It shifts the spread organically and keeps both balances relatively stable.

However, here is my bottleneck: during extremely fast, high-volume trading on a specific pair, this approach still breaks down and gives failures. The bot either lags behind the market and ends up bleeding out the base/quote balance, or it halts due to inventory depletion on one side.

Does anyone here have experience building a custom liquidity module for their bots? What algorithms do you use to protect your inventory during sudden, massive volume spikes while still keeping the bot operational?

Would love to hear some technical insights or ideas on this. Thanks!
Hashblock
Newbie
*
Offline

Activity: 3
Merit: 0


View Profile
August 06, 2026, 05:16:12 PM
 #2

Interesting approach. I think  the main weakness is that your strategy is still reacting after the fill has already been happened. In a fast moving market, by the time the bot recalculates the VWAP, cancels orders, and place new once, the market may have already moved again.

I would like to focus more on inventory management than just spread adjustment. If one side of your inventory reaches a certain threshold, the bot could gradually reduce order size, skew quote towards rebalancing, or even stop quoting that side temporarily instead of waiting until it’s completely deleted.
Another thing to consider is the market conditions, and not just fill volume as an input. During the period of high volatility or unusual aggressive order flow, widening the spread proactively may work better than reacting after large fill.

I’m asking out of curiosity if you have actually compared this against an inventory aware model like the avellaneda stiokov, or your ladder+ shift approach something you develop independently? I think it will be interesting to the how they perform under the same high volume scenario.
BitMaxz
Legendary
*
Offline

Activity: 4074
Merit: 3662


♻️ Automatic Exchange


View Profile WWW
August 06, 2026, 11:40:09 PM
 #3

I like developing bots just like this one related to the market maker bot. Your current issue about your bot is currently in the last stage where, actually, the node is indeed in the loop process but lagging. It could end up buying the top of a dump or selling the bottom of a pump.

The problem is we have fewer traders here who are actually developing a bot. Usually newbies are the ones who post related to trading bots, and then later they add promotion links, or sometimes they sell their bots. So you will get fewer trading developers here that could give you ideas on how to solve your issue.

Have you instead trying to solve it through AI and do some test or I think if you are having issues with spikes and high volume, why not add something to the bot that could cancel all orders immediately, like fire a single "Cancel All"? Not one by one. I think this one would work; avoiding those massive volume and spikes is I think, the only solution if this bot works perfectly on slow price movements.

░░░░▄▄████████████▄
▄████████████████▀
▄████████████████▀▄█▄
▄██████▀▀░░▄███▀▄████▄
▄██████▀░░░▄███▀▀██████▄
██████▀░░▄████▄░░░▀██████
██████░░▀▀▀▀▄▄▄▄░░██████
██████▄░░░▀████▀░░▄██████
▀██████▄▄███▀░░░▄██████▀
▀████▀▄████░░▄▄███████▀
▀█▀▄████████████████▀
▄████████████████▀
▀████████████▀▀░░░░
 
 CCECASH 
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!