BBGO — What’s New in v1.40.x

Published in
4 min readSep 14, 2022

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)

#1 Added New Telegram Commands


For people who wants to reset the position, you can use the telegram bot command /resetposition to reset the position directly. Without the need to open the redis-cli and flushall the settings


For people who manually placed orders to buy/sell some inventory, you can modify the strategy position by yourself. Three fields are modifiable:

  1. Cost — the average cost of your position. This should be a positive number, that is, your average executed price.
  2. Base — this is the base quantity of your position. for example, the quantity of BTC. Positive number means you hold a Long position, negative means you hold a Short position.
  3. Quote — this is quote quantity (or amount) you spent to buy your BTC. for example, -3200 USDT. For long position, the quote is usually a negative number, it means you spend X USDT to buy Y BTC.

#2 New Order Executor API

You can now call the OpenPosition method to open a long/short position in a spot account or a leveraged account. For example, to open a 3x leveraged long position, you can simply call:

Leverage: 3.0,
Long: true,

The account value calculator will fetch the asset price and calculate your account value in USD, and automatically convert the value into the quantity of your order.

#3 New Built-in Strategy — elliotwave

This strategy is a rewrite of ewoDgtrd strategy. If you’re interested in it, you can check out the default config to see how to use it.

#4 New Built-in Strategy — pivotshort

This strategy focuses on opening short, which can be applied to spot, margin account or futures account. You can also setup multiple exit methods to close your position. For example: trailingStop, roiStopLoss, roiTakeProfit, accumulatedVolumeTakeProfit .. and so on..

#5 New Built-in Strategy — supertrend

This built-in strategy is based on the supertrend indicator. It works for both direction, Long and Short.

#6 Built-in Exit Method API

For strategies support built-in exit methods, you can describe your exit conditions in a descriptive YAML, for example:

#7 New bollmaker protection mech

The bollmaker strategy now supports different dynamic spread methods, sigmoid and amplify.

the newly introduced trendEMA indicator also improves the net profit and unrealized profit during the bear market.

bollmaker PnL without trendEMA:

bollmaker PnL with trendEMA:

And this is the date range we used for testing trendEMA:

If you like BBGO and would like to support our project, you can use the following referral link to get a 5% commission kickback:

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



Editor for

Yo-an Lin, yet another programmer in 21 century