Published in


BBGO — BollMaker Trading Bot

Since the rapid development of the cryptocurrency market, grid trading has become widely known as automated trading strategy.

However, there are many problems with the grid trading strategy. For example, you may sell off in a fast-rising market, or get stuck in a fast-falling market, and you need to adjust the price band very frequently.

Grid Orders placed at higher prices and lower prices are not efficiently used, you just hang these orders there and lock your balance and it does not generate any profit if the market price range is small.

At the end, you will find out, Grid Trading is really an inefficient trading strategy!

So, I decided to start developing a new trading bot, a brand new trading strategy that would overcome the shortcomings of the grid strategy.

And strategy bollmaker came into being.

What’s BollMaker?

BollMaker is an acronym for a Bollinger band based market-making strategy.

This strategy uses dual Bollinger bands for trading, but it does not use the bands traditionally.

It uses a band with a short time period to detect fast-moving price.

In addition, a band with a long period of time is used to dynamically adjust the limit of the maximum holding position.

And BollMaker is one of the trading strategies in BBGO — A crypto trading bot framework!

What’s BBGO?

BBGO is an open source crypto trading framework designed for trading bots, written in Go programming language.

What You Can Do With BBGO?

For Trading Bot Users 💁‍♀️ 💁‍♂️ — You can use BBGO to run the built-in strategies.

For Strategy Developers 🥷 — You can use BBGO’s trading unit and back-test unit to implement your own strategies.

For Trading Unit Developers 🧑‍💻 — You can use BBGO’s underlying common exchange API, currently it supports 4+ major exchanges, so you don’t have to repeat the implementation. (BBGO supports Binance, FTX, OKEx and Kucoin)

And, What’s a market maker strategy?

A market maker is a firm, individual or trading strategy that always or often quotes both a buy and a sell price for a financial instrument or commodity, hoping to make a profit by exploiting the difference between the two prices, known as the spread.

As soon as an order is received from a buyer, the Market Maker sells the shares from its own inventory and completes the order. And, this process increases the liquidity in the market. Hence, it is known as Market Making Strategy.

Generally, Market Maker profit by charging higher ask prices (selling) than bid prices (buying). The difference is called the ‘spread’.

The spread compensates the market makers for the risk inherited in such trades which can be the price movement against the market makers’ trading position.

And Market Maker Strategy is the strategy designed for market maker, to provide liquidity. (Grid strategy is also a maker strategy that provides liquidity)

How does BollMaker perform?

Let’s see the back-testing result first:

We used the back-testing data from 2021–08–01 to 2021–09–01. As you can see, the initial capital $20,000, and it realized profit by $7,326.69. The estimated APY is ~= 8293%.

But wait! the APY is just an estimation, APY may vary depending on market fluctuations.

Let me show you the real order history of the BollMaker strategy before we explain these details, here are some screenshots:

BBGO Trading Bot — BollMaker @ DOTUSDT
BBGO Trading Bot — BollMaker @ DOTUSDT
BBGO Trading Bot — BollMaker @ BNBUSDT

How Does It Work?

The BollMaker Strategy uses the long-term period Bollinger Band to control the holding position.

The basic concept is, we assume the price will bounce between the long-term Bollinger band boundary. So, when the price goes up to the upper band, we reduce the position limit, and try to place sell orders as maker. If someone places a taker order to buy from your sell order, then you will sell your inventory.

On the other hand, when the price goes down to the lower band, we increase the position limit, and try to place buy orders as maker. If someone places a taker order to sell his inventory to you, then you will buy your inventory.

For example, when the price is close to the top of the Bollinger Band, we can set “the maximum amount of ETH to buy” is 0.1, and when the price is close to the bottom of the Bollinger Band, we can set “the maximum amount to buy” ETH to 10.

Therefore, through such price movements and dynamic control positions, we can use the spread in the market to buy low and sell high to make a profit.

The strategy locates the price in the band, and uses the exponential scale to calculate the inventory position limit — The lower the price, the higher the holding position.

In this way, the cost of holding positions can be reduced by expanding the position.

By using the concept of average down the cost of position in a downtrend, and when the rebound pulls back to the upper band of the Bollinger Band, the position can be reduced. So as long as you have enough capital, you can make money in the market cycle.

Hence, it’s best to prepare the capital around ~$20,000 when you set the order amount at $20. (Above the minimal order size requirement of the crypto exchange). You will have $20,000/$20 = 1,000 times to average down your inventory cost.

Appropriate Markets and Scenarios

Basically, the main purpose of running the BollMaker strategy is to stock up. Stocking and escaping are two extremes. It is difficult to use the same set of settings to have both. Therefore, you need to choose an asset that you are willing to invest in the long-term, not to choose speculative coins to trade.

When you feel that the market is ready to start stockpiling, it is very suitable to run the BollMaker strategy.

It is recommended to run the currency with relatively high market cap, the trading volume is high, and the volatility is also high. Sometimes when large cap coins fall by 8%, some small cap coins can fall by 20% in one day.

How to setup?

🧑‍💻 Before you get started, if you like my automatic trading strategy, please give me some support and encouragement, and you can use the author’s referral code to register for Binance 🙏


First, you need to prepare an API Key and an API Secret. If you don’t know API Keys, you can check Binance’s FAQ page first.

Then, you need a Linux/MacOS environment, and a redis server for data persistency. (It will be used to store your profit stats and position information):

For Linux:

sudo apt install redis

If the redis package is not found, use redis-server instead:

sudo apt install redis-server

For Mac OS, you can use brew:

brew install redis

Now, you can use the automation script to set up your BBGO:

bash <(curl -s

This script downloads the latest BBGO release binary and set up your API key for BBGO.

And it should show you the following screen:

BBGO — BollMaker Installer

What’s most important though, is that it gives you the bbgo binary also (the bbgo file), a bbgo.yaml config file and a .env.local file for storing your API secret.

If you don’t want to use the script, you can also download the bbgo.yaml file by yourself:


By default, the bollmaker configuration file looks like this:

Now, let me explain these parameters:

  • symbol is the market symbol you want to trade. you can use BTCUSDT , BNBUSDT, or ETHUSDT something like that.
  • interval is the period that you want to replace your maker orders. 1m means it will cancel all open orders and re-place the maker order per minute. valid values are 1m, 5m, 15m , 30m
  • amount is the quote amount of your order. 30 for ETHUSDT market means you want to place a 30 USDT equivalent order to buy/sell ETH. You should have amount set at least above 20
  • quantity is the base amount of your order. 0.1 for ETHUSDT market means you want to buy/sell 0.1 ETH for each order. quantity can not be used with amount, you can only use either amount or quantity.
  • askSpread and bidSpread are the spread you want to place the order. BollMaker uses the mid price to place your maker order. For example, if mid price is 3000, with bidSpread=0.1% and askSpread=0.1%, we will place the buy order at price 2997 and sell order at price 3003. You can use candle chart to find out the amplification of each interval and use them.
    In the best case, you should be able to have buy/sell orders trade per interval. Please note that the rate of transaction fees must be taken into account. On Binance, the maker fee rate is about 0.075%, so make sure your bidSpread + askSpread > (0.075% * 2).
  • minProfitSpread is the spread from the average cost of your inventory. when Price ≥ AVERAGE_COST * (1.0 + minProfitSpread), then the sell order be will placed. You can set this number to a higher value like 1% or even 3% to prevent you sell the inventory too early.

And then, the following section is the most important section:

domain -1 means the lower band of the long-term Bollinger band.

doamin 1 means the upper band of the long-term Bollinger band.

For example, if you would like to trade in ETHUSDT,

10.0 means, when the price goes down to the boundary of the lower band, you will have the maximum position limit at 10 ETH.

And 1.0 means, when the prices goes up to the boundary of the upper band, you will have the maximum position limit at 1.0 ETH. If your inventory is higher than the maximum position limit, it will not stop placing buy orders, until the sell orders are executed and filled.

  • long means you don’t want to hold a short position. If short mode is enabled, it will sell the inventory that you already have in the spot wallet. You can turn on long when you think the price is low enough. And turn on short when you think the price is high enough.
  • buyBelowNeutralSMA is an option to limit the buy order — only place buy orders below the SMA of the neutral Bollinger band (the short-term Bollinger band)
  • tradeInBand — If this is set, when the price is out of the neutral Bollinger band (the short-term Bollinger band), it will stop placing buy order and sell order.
  • defaultBollinger — This is the Bollinger Band used for controlling the position limit. You can use TradingView or Binance’s KLines Chart to see which interval is preferred and works best for you.
  • neutralBollinger — This is the Bollinger Band used for detecting short-term trend.

The default configuration is the best parameters as far as I know. so you should be able to run it directly.

It’s pretty straight-forward to run BBGO, simply type:

./bbgo run

You should then see the console logs from BBGO:

As you can see, it calculates the max position limit per interval:

calculated max exposure position: 2.02801869 strategy=bollmaker

And following band is used for calculating the exposition position limit:

bollinger band: up 2884.638519 sma 2824.866667 down 2765.094815 strategy=bollmaker

And that’s it!

If you need any help with BBGO, you can create an issue in the GitHub project, or join our telegram group:



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Yo-an Lin, yet another programmer in 21 century