The modern cryptocurrency trading bot written in Go.

bbgo

A trading bot framework written in Go. The name bbgo comes from the BB8 bot in the Star Wars movie. aka Buy BitCoin Go!

Current Status

Build Status

Features

  • Exchange abstraction interface
  • Stream integration (user data websocket)
  • PnL calculation
  • Slack notification
  • KLine-based backtest
  • Built-in strategies
  • Multi-session support
  • Standard indicators (SMA, EMA, BOLL)

Supported Exchanges

  • MAX Exchange (located in Taiwan)
  • Binance Exchange
  • FTX (working in progress)

Requirements

Get your exchange API key and secret after you register the accounts (you can choose one or more exchanges):

Since the exchange implementation and support are done by a small team, if you like the work they've done for you, It would be great if you can use their referral code as your support to them. :-D

Installation

Install from binary

The following script will help you set up a config file, dotenv file:

bash <(curl -s https://raw.githubusercontent.com/c9s/bbgo/main/scripts/setup-grid.sh)

Install and Run from the One-click Linode StackScript:

Install from source

Install the bbgo command:

go get -u github.com/c9s/bbgo/cmd/bbgo

Add your dotenv file:

# if you have one
BINANCE_API_KEY=
BINANCE_API_SECRET=

# if you have one
MAX_API_KEY=
MAX_API_SECRET=

# if you have one
FTX_API_KEY=
FTX_API_SECRET=
# specify it if credentials are for subaccount
FTX_SUBACCOUNT=

Prepare your dotenv file .env.local and BBGO yaml config file bbgo.yaml.

The minimal bbgo.yaml could be generated by:

curl -o bbgo.yaml https://raw.githubusercontent.com/c9s/bbgo/main/config/minimal.yaml

To sync your own trade data:

bbgo sync --session max
bbgo sync --session binance

If you want to switch to other dotenv file, you can add an --dotenv option or --config:

bbgo sync --dotenv .env.dev --config config/grid.yaml --session binance

To sync remote exchange klines data for backtesting:

bbgo backtest --exchange binance -v --sync --sync-only --sync-from 2020-01-01

To run backtest:

bbgo backtest --exchange binance --base-asset-baseline

To query transfer history:

bbgo transfer-history --session max --asset USDT --since "2019-01-01"

To calculate pnl:

bbgo pnl --exchange binance --asset BTC --since "2019-01-01"

To run strategy:

bbgo run

Advanced Setup

Setting up Telegram Bot Notification

Open your Telegram app, and chat with @botFather

Enter /newbot to create a new bot

Enter the bot display name. ex. your_bbgo_bot

Enter the bot username. This should be global unique. e.g., bbgo_bot_711222333

Botfather will response your a bot token. Keep bot token safe

Set TELEGRAM_BOT_TOKEN in the .env.local file, e.g.,

TELEGRAM_BOT_TOKEN=347374838:ABFTjfiweajfiawoejfiaojfeijoaef

For the telegram chat authentication (your bot needs to verify it's you), if you only need a fixed authentication token, you can set TELEGRAM_AUTH_TOKEN in the .env.local file, e.g.,

TELEGRAM_BOT_AUTH_TOKEN=itsme55667788

Run your bbgo,

Open your Telegram app, search your bot bbgo_bot_711222333

Enter /start and /auth {code}

Done! your notifications will be routed to the telegram chat.

Setting up Slack Notification

Put your slack bot token in the .env.local file:

SLACK_TOKEN=xxoox

Synchronizing Trading Data

By default, BBGO does not sync your trading data from the exchange sessions, so it's hard to calculate your profit and loss correctly.

By synchronizing trades and orders to the local database, you can earn some benefits like PnL calculations, backtesting and asset calculation.

Configure MySQL Database

To use MySQL database for data syncing, first you need to install your mysql server:

# For Ubuntu Linux
sudo apt-get install -y mysql-server

Or run it in docker

Create your mysql database:

mysql -uroot -e "CREATE DATABASE bbgo CHARSET utf8"

Then put these environment variables in your .env.local file:

DB_DRIVER=mysql
DB_DSN=root@tcp(127.0.0.1:3306)/bbgo

Configure Sqlite3 Database

Just put these environment variables in your .env.local file:

DB_DRIVER=sqlite3
DB_DSN=bbgo.sqlite3

Built-in Strategies

Check out the strategy directory strategy for all built-in strategies:

  • pricealert strategy demonstrates how to use the notification system pricealert
  • xpuremaker strategy demonstrates how to maintain the orderbook and submit maker orders xpuremaker
  • buyandhold strategy demonstrates how to subscribe kline events and submit market order buyandhold
  • bollgrid strategy implements a basic grid strategy with the built-in bollinger indicator bollgrid
  • grid strategy implements the fixed price band grid strategy grid
  • flashcrash strategy implements a strategy that catches the flashcrash flashcrash

To run these built-in strategies, just modify the config file to make the configuration suitable for you, for example if you want to run buyandhold strategy:

vim config/buyandhold.yaml

# run bbgo with the config
bbgo run --config config/buyandhold.yaml

Adding New Built-in Strategy

Fork and clone this repository, Create a directory under pkg/strategy/newstrategy, write your strategy at pkg/strategy/newstrategy/strategy.go.

Define a strategy struct:

package newstrategy

import (
	"github.com/c9s/bbgo/pkg/fixedpoint"
)

type Strategy struct {
	Symbol string `json:"symbol"`
	Param1 int `json:"param1"`
    Param2 int `json:"param2"`
    Param3 fixedpoint.Value `json:"param3"`
}

Register your strategy:

const ID = "newstrategy"

const stateKey = "state-v1"

var log = logrus.WithField("strategy", ID)

func init() {
    bbgo.RegisterStrategy(ID, &Strategy{})
}

Implement the strategy methods:

func (s *Strategy) Subscribe(session *bbgo.ExchangeSession) {
    session.Subscribe(types.KLineChannel, s.Symbol, types.SubscribeOptions{Interval: "1m"})
}

func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, session *bbgo.ExchangeSession) error {
	// ....
	return nil
}

Edit pkg/cmd/builtin.go, and import the package, like this:

package cmd

// import built-in strategies
import (
	_ "github.com/c9s/bbgo/pkg/strategy/bollgrid"
	_ "github.com/c9s/bbgo/pkg/strategy/buyandhold"
	_ "github.com/c9s/bbgo/pkg/strategy/flashcrash"
	_ "github.com/c9s/bbgo/pkg/strategy/grid"
	_ "github.com/c9s/bbgo/pkg/strategy/mirrormaker"
	_ "github.com/c9s/bbgo/pkg/strategy/pricealert"
	_ "github.com/c9s/bbgo/pkg/strategy/support"
	_ "github.com/c9s/bbgo/pkg/strategy/swing"
	_ "github.com/c9s/bbgo/pkg/strategy/trailingstop"
	_ "github.com/c9s/bbgo/pkg/strategy/xmaker"
	_ "github.com/c9s/bbgo/pkg/strategy/xpuremaker"
)

Write your own strategy

Create your go package, and initialize the repository with go mod and add bbgo as a dependency:

go mod init
go get github.com/c9s/bbgo@main

Write your own strategy in the strategy file:

vim strategy.go

You can grab the skeleton strategy from https://github.com/c9s/bbgo/blob/main/pkg/strategy/skeleton/strategy.go

Now add your config:

mkdir config
(cd config && curl -o bbgo.yaml https://raw.githubusercontent.com/c9s/bbgo/main/config/minimal.yaml)

Add your strategy package path to the config file config/bbgo.yaml

---
build:
  dir: build
  imports:
  - github.com/your_id/your_swing
  targets:
  - name: swing-amd64-linux
    os: linux
    arch: amd64
  - name: swing-amd64-darwin
    os: darwin
    arch: amd64

Run bbgo run command, bbgo will compile a wrapper binary that imports your strategy:

dotenv -f .env.local -- bbgo run --config config/bbgo.yaml

Or you can build your own wrapper binary via:

bbgo build --config config/bbgo.yaml

Dynamic Injection

In order to minimize the strategy code, bbgo supports dynamic dependency injection.

Before executing your strategy, bbgo injects the components into your strategy object if it found the embedded field that is using bbgo component. for example:

type Strategy struct {
*bbgo.Notifiability
}

And then, in your code, you can call the methods of Notifiability.

Supported components (single exchange strategy only for now):

  • *bbgo.Notifiability
  • bbgo.OrderExecutor

If you have Symbol string field in your strategy, your strategy will be detected as a symbol-based strategy, then the following types could be injected automatically:

  • *bbgo.ExchangeSession
  • types.Market

Strategy Execution Phases

  1. Load config from the config file.
  2. Allocate and initialize exchange sessions.
  3. Add exchange sessions to the environment (the data layer).
  4. Use the given environment to initialize the trader object (the logic layer).
  5. The trader initializes the environment and start the exchange connections.
  6. Call strategy.Run() method sequentially.

Exchange API Examples

Please check out the example directory: examples

Initialize MAX API:

key := os.Getenv("MAX_API_KEY")
secret := os.Getenv("MAX_API_SECRET")

maxRest := maxapi.NewRestClient(maxapi.ProductionAPIURL)
maxRest.Auth(key, secret)

Creating user data stream to get the orderbook (depth):

stream := max.NewStream(key, secret)
stream.Subscribe(types.BookChannel, symbol, types.SubscribeOptions{})

streambook := types.NewStreamBook(symbol)
streambook.BindStream(stream)

How To Add A New Exchange

(TBD)

Helm Chart

Prepare your docker image locally (you can also use the docker image from docker hub):

make docker DOCKER_TAG=1.16.0

The docker tag version number is from the file Chart.yaml

Prepare your secret:

kubectl create secret generic bbgo-grid --from-env-file .env.local

Configure your config file, the chart defaults to read config/bbgo.yaml to create a configmap:

cp config/grid.yaml config/bbgo.yaml
vim config/bbgo.yaml

Install chart with the preferred release name, the release name maps to the previous secret we just created, that is, bbgo-grid:

helm install bbgo-grid ./charts/bbgo

Delete chart:

helm delete bbgo

Development

Setting up your local repository

  1. Click the "Fork" button from the GitHub repository.
  2. Clone your forked repository into $GOPATH/github.com/c9s/bbgo.
  3. Change directory into $GOPATH/github.com/c9s/bbgo.
  4. Create a branch and start your development.
  5. Test your changes.
  6. Push your changes to your fork.
  7. Send a pull request.

Adding new migration

rockhopper --config rockhopper_sqlite.yaml create --type sql add_pnl_column
rockhopper --config rockhopper_mysql.yaml create --type sql add_pnl_column

or

bash utils/generate-new-migration.sh add_pnl_column

Be sure to edit both sqlite3 and mysql migration files.

To test the drivers, you can do:

rockhopper --config rockhopper_sqlite.yaml up
rockhopper --config rockhopper_mysql.yaml up

Setup frontend development environment

cd frontend
yarn install

Testing Desktop App

for webview

make embed && go run -tags web ./cmd/bbgo-webview

for lorca

make embed && go run -tags web ./cmd/bbgo-lorca

Support

By contributing pull requests

Any pull request is welcome, documentation, format fixing, testing, features.

By registering account with referral ID

You may register your exchange account with my referral ID to support this project.

By small amount cryptos

  • BTC address 3J6XQJNWT56amqz9Hz2BEVQ7W4aNmb5kiU
  • USDT ERC20 address 0x63E5805e027548A384c57E20141f6778591Bac6F

Community

You can join our telegram channel https://t.me/bbgocrypto, it's in Chinese, but English is fine as well.

Contribution

BBGO has a token BBG for the ecosystem (contract address: https://etherscan.io/address/0x3afe98235d680e8d7a52e1458a59d60f45f935c0).

Each issue has its BBG label, by completing the issue with a pull request, you can get correspond amount of BBG.

If you have feature request, you can offer your BBG for contributors.

For further request, please contact us: https://t.me/c123456789s

License

MIT License

Owner
Yo-An Lin
a developer who really loves crafting tools
Yo-An Lin
Comments
  • strategy: grid2 [part2] -- reverse order and arb profit calculation

    strategy: grid2 [part2] -- reverse order and arb profit calculation

    • [x] quoteInvestment, baseInvestment calculation
    • [ ] persist grid orders (without canceling grid orders)
    • [x] shutdownCloseGrid option (close grid when shutting down bbgo)
    • [ ] auto priceRange detection
    • [ ] replay order update from the RESTful API (for updating grid state)
    • [x] earn: quote or earn: base
    • [ ] grid number limitation calculation
    • [x] order fee calculation
    • [x] handle filled orders
    • [ ] geometric grid calculation
    • [x] create grid trigger
    • [x] stop loss (close grid trigger)
    • [x] take profit (close grid trigger)
  • strategy: grid2 [part 1] - initializing grid orders

    strategy: grid2 [part 1] - initializing grid orders

    • [x] quoteInvestment, baseInvestment calculation
    • [ ] earn: quote or earn: base
    • [ ] grid number limitation calculation
    • [ ] order fee calculation
    • [ ] handle filled orders
    • [ ] geometric grid calculation
    • [ ] create grid trigger
    • [ ] stop loss (close grid trigger)
    • [ ] take profit (close grid trigger)
  • feature: drift study

    feature: drift study

    add drift strategy for study purpose.

    • plot series
    • dynamic kline (result is bad, remove related implementation from strategy)
    • fix bug for SeriesExtend.Array/Reverse image
  • feature: backtest report - #2 state recorder

    feature: backtest report - #2 state recorder

    • [x] Use reflect to scan strategy instance fields and record known object types into CSV files
    • [x] Strategy State Recorder
      • [x] Position Recorder
      • [x] Equity Curve Recorder
      • [x] Stop Order Recorder
      • [ ] Profit / Loss Recorder
  • add tearsheet backend api (Sharpe)

    add tearsheet backend api (Sharpe)

    refer: https://github.com/c9s/bbgo/issues/463

    also extend all indicators to be SeriesExtend, and resolve null pointer exception in previous version of SeriesBase when doing lazy init.

  • strategy:irr: a mean reversion based on box of klines in same direction

    strategy:irr: a mean reversion based on box of klines in same direction

    Due to the severe "delay" issue in binance 1s kline stream. ~~We've refactored irr strategy into backtesting mode (consume KLine onClose), and real-time mode (consume bookTicker which triggered every interval via goroutine)~~

    ~~Now we've redesigned the time ticker(goroutine) to consume aggerate trade market stream based on web socket .~~

    Rollback to interval time trigger for a much easier programming model and really small intervals.

  • 請問該怎麼讓 bollgrid 策略一直跑下去呢?

    請問該怎麼讓 bollgrid 策略一直跑下去呢?

    c9s 大大你好,我這兩天有嘗試使用 bbgo 的 bollgrid 策略,但遇到一些問題

    我的 binary 是 BBGO v1.10.0 Linux 版本,以下是我的設定檔

    ---
    riskControls:
      sessionBased:
        max:
          orderExecutor:
            bySymbol:
              BTCUSDT:
                # basic risk control order executor
                basic:
                  minQuoteBalance: 0.0
                  maxBaseAssetBalance: 0.0 # disable
                  minBaseAssetBalance: 0.0 # disable
                  maxOrderAmount: 3000.0
    
    exchangeStrategies:
      - on: max
        bollgrid:
          symbol: BTCUSDT
          interval: 5m
          gridNumber: 20
          quantity: 0.0015
          profitSpread: 50.0
    

    一開始執行時會 log 出很多 submit order 的訊息,看起來都很正常,而且到 MAX 交易所上看確實也有正常掛單

    Screen Shot 2021-01-29 at 3 04 28 PM

    但執行了一陣子,全部的單都成交了(買進 BTC 又賣出)之後,BBGO 就不會繼續下單了,只有每分鐘把最新的 kline 價錢 log 出來。所以我又會把程式關掉重新執行,他才會再開始下一波的下單交易

    Screen Shot 2021-01-29 at 3 05 49 PM

    我希望他可以在一波單結束之後就繼續下一波,不用自己重開程式,所以想請問是我的設定檔哪部分寫錯了嗎,還是說本來執行一次就是只有進行一波買進、賣出?

    謝謝 c9s,能寫出 bbgo 真的很厲害

  • fix: apply gofmt on all files, add revive action

    fix: apply gofmt on all files, add revive action

    the target of this pr is to setup a set of check on:

    1. gofmt
    2. lint (by revive)
    3. codeql
    4. gocyclo(maybe) / goreportcard

    add badge on README, and fix related issues.

  • Grid strategy not working

    Grid strategy not working

    No matter what I do, I can't get the grid strategy to generate trades (in backtesting).

    I filled/synced the data correctly using:

    ./bbgo backtest --exchange binance -v --sync --sync-only --sync-from 2021-11-20 --config grid.yaml

    My grid.yaml is like this:

    
    arthur@crypto:~/bbgo$ cat grid.yaml
    ---
    sessions:
      binance:
        exchange: binance
        envVarPrefix: binance
    backtest:
      startTime: "2021-11-25"
      endTime: "2021-11-28"
      symbols:
      - ATAUSDT
      account:
        #makerCommission: 15
        #takerCommission: 15
        balances:
          ATA: 0.0
          USDT: 100000
    exchangeStrategies:
    - on: binance
      grid:
        symbol: ATAUSDT
        quantity: 100
        gridNumber: 100
        profitSpread: 0.05
        upperPrice: 1.5
        lowerPrice: 1.0
        long: true
    
    

    And I run it with the following command:

    ./bbgo backtest --exchange binance --sync-from 2021-11-01 --config grid.yaml --base-asset-baseline

    And I get the following result:

    
    arthur@crypto:~/bbgo$ ./bbgo backtest --exchange binance --sync-from 2021-11-01 --config grid.yaml --base-asset-baseline
    [0000]  INFO starting backtest with startTime Thu Nov 25 00:00:00 2021
    [0010]  INFO ATAUSDT PROFIT AND LOSS REPORT
    [0010]  INFO ===============================================
    [0010]  INFO TRADES SINCE: 0001-01-01 00:00:00 +0000 UTC
    [0010]  INFO NUMBER OF TRADES: 0
    [0010]  INFO AVERAGE COST: $ 0.00
    [0010]  INFO TOTAL BUY VOLUME: 0.000000
    [0010]  INFO TOTAL SELL VOLUME: 0.000000
    [0010]  INFO STOCK: 0.000000
    [0010]  INFO FEE (USD): 0.000000
    [0010]  INFO CURRENT PRICE: $ 1.21
    [0010]  INFO CURRENCY FEES:
    [0010]  INFO PROFIT: $ 0.00
    [0010]  INFO UNREALIZED PROFIT: $ 0.00
    [0010]  INFO INITIAL BALANCES:
    [0010]  INFO  USDT: 100000.000000
    [0010]  INFO FINAL BALANCES:
    [0010]  INFO  USDT: 100000.000000
    [0010]  INFO INITIAL ASSET ~= 96665 ATA (1 ATA = 1.034500)
    [0010]  INFO FINAL ASSET ~= 82987 ATA (1 ATA = 1.205000)
    [0010]  INFO ATA BASE ASSET PERFORMANCE: -14.15% (= (82987.55 - 96665.06) / 96665.06)
    [0010]  INFO ATA PERFORMANCE: 16.48% (= (1.21 - 1.03) / 1.03)
    

    Adding -v to the command, here are the initial lines (before the screen is filled with "k-line closed" lines):

    time="2021-11-29T00:50:20Z" level=info msg="starting backtest with startTime Thu Nov 25 00:00:00 2021"
    time="2021-11-29T00:50:20Z" level=info msg="setting risk controls: &{SessionBasedRiskControl:map[]}"
    time="2021-11-29T00:50:20Z" level=info msg="attaching strategy *grid.Strategy on binance instead of [binance]"
    time="2021-11-29T00:50:20Z" level=info msg="querying market info..." exchange=binance
    time="2021-11-29T00:50:20Z" level=info msg="querying balances from session binance..." session=binance
    time="2021-11-29T00:50:20Z" level=info msg="binance account" session=binance
    time="2021-11-29T00:50:20Z" level=info msg=" USDT: 100000.000000"
    time="2021-11-29T00:50:20Z" level=info msg="SELECT * FROM trades WHERE exchange = :exchange AND symbol = :symbol ORDER BY gid ASC"
    time="2021-11-29T00:50:20Z" level=info msg="symbol ATAUSDT: 0 trades loaded"
    time="2021-11-29T00:50:25Z" level=info msg="ATAUSDT last price: 1.034500"
    time="2021-11-29T00:50:25Z" level=info msg="found symbol based strategy from grid.Strategy"
    time="2021-11-29T00:50:25Z" level=info msg="using group id 1813379259 from fnv(grid-ATAUSDT-100-150000000-100000000)" strategy=grid
    time="2021-11-29T00:50:25Z" level=info msg="subscribing ATAUSDT kline 1m" session=binance
    time="2021-11-29T00:50:25Z" level=info msg="connecting session binance..." session=binance
    time="2021-11-29T00:50:25Z" level=info msg="collecting backtest configurations..."
    time="2021-11-29T00:50:25Z" level=info msg="used symbols: [ATAUSDT] and intervals: [1m 1d]"
    time="2021-11-29T00:50:25Z" level=info msg="kline closed: binance 2021-11-25 00:00 ATAUSDT 1m Open: 1.03450000 Close: 1.03700000 High: 1.03880000 Low: 1.03300000 Volume: 11707.00000000 Change: 0.0025 Max Change: 0.0058" marketData=kline session=binance
    time="2021-11-29T00:50:25Z" level=info msg="kline closed: binance 2021-11-25 00:01 ATAUSDT 1m Open: 1.03640000 Close: 1.03710000 High: 1.03800000 Low: 1.03520000 Volume: 5464.00000000 Change: 0.0007 Max Change: 0.0028" marketData=kline session=binance
    time="2021-11-29T00:50:25Z" level=info msg="kline closed: binance 2021-11-25 00:02 ATAUSDT 1m Open: 1.03790000 Close: 1.03530000 High: 1.03790000 Low: 1.03520000 Volume: 7278.00000000 Change: -0.0026 Max Change: 0.0027" marketData=kline session=binance
    time="2021-11-29T00:50:25Z" level=info msg="kline closed: binance 2021-11-25 00:03 ATAUSDT 1m Open: 1.03430000 Close: 1.03710000 High: 1.03720000 Low: 1.03420000 Volume: 9097.00000000 Change: 0.0028 Max Change: 0.0030" marketData=kline session=binance
    time="2021-11-29T00:50:25Z" level=info msg="kline closed: binance 2021-11-25 00:04 ATAUSDT 1m Open: 1.03520000 Close: 1.03360000 High: 1.03530000 Low: 1.03270000 Volume: 6041.00000000 Change: -0.0016 Max Change: 0.0026" marketData=kline session=binance
    time="2021-11-29T00:50:25Z" level=info msg="kline closed: binance 2021-11-25 00:05 ATAUSDT 1m Open: 1.03360000 Close: 1.03430000 High: 1.03430000 Low: 1.03270000 Volume: 2206.00000000 Change: 0.0007 Max Change: 0.0016" marketData=kline session=binance
    time="2021-11-29T00:50:25Z" level=info msg="kline closed: binance 2021-11-25 00:06 ATAUSDT 1m Open: 1.03310000 Close: 1.03290000 High: 1.03450000 Low: 1.03290000 Volume: 816.00000000 Change: -0.0002 Max Change: 0.0016" marketData=kline session=binance
    time="2021-11-29T00:50:25Z" level=info msg="kline closed: binance 2021-11-25 00:07 ATAUSDT 1m Open: 1.03250000 Close: 1.02470000 High: 1.03280000 Low: 1.02290000 Volume: 46101.00000000 Change: -0.0078 Max Change: 0.0099" marketData=kline session=binance
    time="2021-11-29T00:50:25Z" level=info msg="kline closed: binance 2021-11-25 00:08 ATAUSDT 1m Open: 1.02480000 Close: 1.02280000 High: 1.02500000 Low: 1.02010000 Volume: 13110.00000000 Change: -0.0020 Max Change: 0.0049" marketData=kline session=binance
    time="2021-11-29T00:50:25Z" level=info msg="kline closed: binance 2021-11-25 00:09 ATAUSDT 1m Open: 1.02270000 Close: 1.02040000 High: 1.02360000 Low: 1.02020000 Volume: 13339.00000000 Change: -0.0023 Max Change: 0.0034" marketData=kline session=binance
    time="2021-11-29T00:50:25Z" level=info msg="kline closed: binance 2021-11-25 00:10 ATAUSDT 1m Open: 1.02150000 Close: 1.02160000 High: 1.02340000 Low: 1.02150000 Volume: 2375.00000000 Change: 0.0001 Max Change: 0.0019" marketData=kline session=binance
    time="2021-11-29T00:50:25Z" level=info msg="kline closed: binance 2021-11-25 00:11 ATAUSDT 1m Open: 1.02180000 Close: 1.02020000 High: 1.02180000 Low: 1.02020000 Volume: 8237.00000000 Change: -0.0016 Max Change: 0.0016" marketData=kline session=binance
    

    I should get trades, with these same parameters, other bots (Kucoin's UI, and a modified zenbot) generate trades, but for some reason I can't get any trades to happen here.

    Am I doing something wrong with the parameters or the config somehow ?

    I'm using MySQL for the backend.

    Any help would be extremely welcome, and whatever the solution is, I'll create a PR with the answer to add it to the documentation (if adequate).

    Thanks a lot in advance!

  • Improve supertrend strategy

    Improve supertrend strategy

    winningRatio: "1.50000000"
    numOfLossTrade: 4
    numOfProfitTrade: 6
    grossProfit: "9510.58490673"
    grossLoss: "-1616.37687265"
    profits:
        - "962.02614650"
        - "1492.98331752"
        - "2013.07243890"
        - "0.00006635"
        - "557.31764608"
        - "4485.18529138"
    losses:
        - "-402.85689998"
        - "-384.84449514"
        - "-376.47721820"
        - "-452.19825933"
    mostProfitableTrade: "4485.18529138"
    mostLossTrade: "-452.19825933"
    profitFactor: "-5.88389073"
    totalNetProfit: "7894.20803408"
    
    BACK-TEST REPORT
    ===============================================
    START TIME: Tue, 01 Mar 2022 00:00:00 UTC
    END TIME: Thu, 30 Jun 2022 00:00:00 UTC
    INITIAL TOTAL BALANCE: BalanceMap[BTC: 1, USDT: 10000]
    FINAL TOTAL BALANCE: BalanceMap[BTC: 1.885876, USDT: 0.0000659]
    binance BTCUSDT PROFIT AND LOSS REPORT
    ===============================================
    TRADES SINCE: 2022-03-01 21:04:59.999 +0000 UTC
    NUMBER OF TRADES: 19
    AVERAGE COST: $ 20,199.45
    BASE ASSET POSITION: 0.885876
    TOTAL BUY VOLUME: 3.49511477
    TOTAL SELL VOLUME: 2.60923877
    CURRENT PRICE: $ 20,122.58
    CURRENCY FEES:
     - FEE: 152.2463837
    PROFIT: $ 7,894.21
    UNREALIZED PROFIT: -$ 68.10
    INITIAL ASSET IN USDT ~= 53160.00000 USDT (1 BTC = 43160)
    FINAL ASSET IN USDT ~= 37948.69074 USDT (1 BTC = 20122.58)
    REALIZED PROFIT: +7894.20803408 USDT
    UNREALIZED PROFIT: -68.09728812 USDT
    ASSET DECREASED: -15211.30925402 USDT (-28.61%)
    
  • optimizeex: hyperparameter optimization tool

    optimizeex: hyperparameter optimization tool

    In this PR, we provide a new subcommand bbgo optimizeex to perform hyper-parameter optimization. This new optimizer is expected to mitigate the pain point of conventional grid search when number of grid points increases.

    The optimizer configuration is backward compatible with existing optimizer.yaml used by bbgo optimize.

    Usage

    bbgo optimizeex --config strategy.yaml --optimizer-config optimizer.yaml

    Very similar to the original optimizer. Adjust maxEvaluation in configuration to make the optimization faster or more accurate.

    Supported Search Algorithms

    • Tree-structured Parzen Estimators (tpe, default)
    • Covariance Matrix Adaptation Evolution Strategy (cmaes)
    • Quasi-monte carlo sampling based on Sobol sequence (sobol)
    • random search (random)

    With the following objective function to be maximize:

    • profit
    • volume
    • equity (default)

    See config/optimizer-hyperparam-search.yaml for detailed configuration.

    Future Work

    The under layer optimization framework used in this PR supports pausing and decentralized search using RDBs. Consider implement this part in the future.

  • record sent orders into the db

    record sent orders into the db

    should be implemented in the order executor, when sending an order to the exchange, we should record the order object into the db, so that we can tag the order.

  • get-order command error

    get-order command error

    executing get-ordercommand ../bin/bbgo-slim get-order --order-id 16863344284 --session=binance --symbol=BTCUSDT --dotenv .env.binance.btcusdt

    Result FATAL cannot execute command error=<APIError> code=-1105, msg=Parameter 'symbol' was empty.

    cmd/orders.go service.QueryOrder should add symbol to Parameter list

A fast cryptocurrency trading bot implemented in Go
A fast cryptocurrency trading bot implemented in Go

A fast cryptocurrency bot framework implemented in Go. Ninjabot permits users to create and test custom strategies for spot markets. ⚠️ Caution: Worki

Jan 1, 2023
CryptoPump is a cryptocurrency trading bot that focuses on high speed and flexibility
CryptoPump is a cryptocurrency trading bot that focuses on high speed and flexibility

CryptoPump is a cryptocurrency trading bot that focuses on high speed and flexibility. The algorithms utilize Go Language and WebSockets to react in real-time to market movements based on Bollinger statistical analysis and pre-defined profit margins.

Nov 24, 2022
A golang implementation of a console-based trading bot for cryptocurrency exchanges
A golang implementation of a console-based trading bot for cryptocurrency exchanges

Golang Crypto Trading Bot A golang implementation of a console-based trading bot for cryptocurrency exchanges. Usage Download a release or directly bu

Jun 4, 2022
A telegram bot that fetches multiple RSS cryptocurrency news feeds for sentiment analysis

Crypto News Telegram Bot A simple telegram bot that will help you stay updated on your latest crypto news This bot will help you keep track of the lat

Aug 22, 2021
Kelp is a free and open-source trading bot for the Stellar DEX and 100+ centralized exchanges
Kelp is a free and open-source trading bot for the Stellar DEX and 100+ centralized exchanges

Kelp Kelp is a free and open-source trading bot for the Stellar universal marketplace and for centralized exchanges such as Binance, Kraken, CoinbaseP

Jan 6, 2023
BlueBot is an open-source trading bot that can be customized to handle specific investment strategies.

BlueBot Quick Note BlueBot and all mentioned services are free to use, including supported financial APIs. Overview BlueBot is a self-healing trading

Sep 7, 2022
Crypto signal trading bot

Crypto-signal-trading-bot Firstly a warning This project has the ability to spen

Dec 15, 2022
Bot-template - A simple bot template for creating a bot which includes a config, postgresql database

bot-template This is a simple bot template for creating a bot which includes a c

Sep 9, 2022
A bot based on Telegram Bot API written in Golang allows users to download public Instagram photos, videos, and albums without receiving the user's credentials.

InstagramRobot InstagramRobot is a bot based on Telegram Bot API written in Golang that allows users to download public Instagram photos, videos, and

Dec 16, 2021
Cryptocurrency implemented using the Go programming language

Nomadcoin Making a Cryptocurrency using the Go programming language. Features Mining Transactions Database Backend Wallets REST API HTML Explorer P2P

Dec 7, 2022
Automated Trader (at). Framework for building trading bots.
Automated Trader (at). Framework for building trading bots.

Automated Trader (at) Purpose: Framework for building automated trading strategies in three steps: Build your own strategy. Verify it with the backtes

Dec 14, 2022
Tripwire is trading platform interface

Tripwire A Golang SDK for binance API. All the REST APIs listed in binance API document are implemented, as well as the websocket APIs. For best compa

Nov 28, 2021
A trading robot, that can submit basic orders in an automated fashion.
A trading robot, that can submit basic orders in an automated fashion.

Source: https://github.com/harunnryd/btrade Issues: https://github.com/harunnryd/btrade/issues Twitter: @harunnryd LinkedIn: @harunnryd btrade is a ro

Jan 26, 2022
Dlercloud-telegram-bot - A Telegram bot for managing your Dler Cloud account

Dler Cloud Telegram Bot A Telegram bot for managing your Dler Cloud account. Usa

Dec 30, 2021
Quote-bot - Un bot utilisant l'API Twitter pour tweeter une citation par jour sur la programmation et les mathématiques.

Description Ceci est un simple bot programmé en Golang qui tweet une citation sur la programmation tout les jours. Ce bot est host sur le compte Twitt

Jan 1, 2022
Discord-bot - A Discord bot with golang

JS discord bots Install Clone repo git clone https://github.com/fu-js/discord-bo

Aug 2, 2022
Bot - Telegram Music Bot in Go

Telegram Music Bot in Go An example bot using gotgcalls. Setup Install the serve

Jun 28, 2022
Pro-bot - A telegram bot to play around with the community telegram channels

pro-bot ?? Pro Bot A Telegram Bot to Play Around With The Community Telegram Cha

Jan 24, 2022
Slack-emoji-bot - This Slack bot will post the newly created custom Slack emojis to the channel of your choice

Slack Emoji Bot This Slack bot will post the newly created custom Slack emojis t

Oct 21, 2022