Skip to content

Commit

Permalink
Merge branch 'c9s:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
chendagan authored May 1, 2022
2 parents 44f2480 + faccc64 commit 2c9f6d0
Show file tree
Hide file tree
Showing 151 changed files with 3,314 additions and 580 deletions.
682 changes: 661 additions & 21 deletions LICENSE

Large diffs are not rendered by default.

27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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!
A trading bot framework written in Go. The name bbgo comes from the BB8 bot in the Star Wars movie.

## Current Status

Expand All @@ -15,8 +15,19 @@ A trading bot framework written in Go. The name bbgo comes from the BB8 bot in t
[![Telegram Taiwan](https://img.shields.io/badge/telegram-tw-blue.svg)](https://t.me/bbgocrypto)
[![Twitter](https://img.shields.io/twitter/follow/bbgotrading?label=Follow&style=social)](https://twitter.com/bbgotrading)

## Documentation and General Topics
- Check the [documentation index](doc/README.md)
## What You Can Do With BBGO

### Trading Bot Users

You can use BBGO to run the built-in strategies.

### Strategy Developers

You can use BBGO's trading unit and back-test unit to implement your own strategies.

### 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.

## Features

Expand All @@ -27,8 +38,7 @@ A trading bot framework written in Go. The name bbgo comes from the BB8 bot in t
- PnL calculation.
- Slack/Telegram notification.
- Back-testing: KLine-based back-testing engine. See [Back-testing](./doc/topics/back-testing.md)
- Built-in Grid strategy.
- Many built-in strategies.
- Built-in Grid strategy and many other built-in strategies.
- Multi-exchange session support: you can connect to more than 2 exchanges with different accounts or subaccounts.
- Standard indicators, e.g., SMA, EMA, BOLL, VMA, MACD...
- React-powered Web Dashboard.
Expand All @@ -49,7 +59,12 @@ A trading bot framework written in Go. The name bbgo comes from the BB8 bot in t
- Kucoin Spot Exchange
- MAX Spot Exchange (located in Taiwan)


## Documentation and General Topics
- Check the [documentation index](doc/README.md)

## BBGO Tokenomics

To support the development of BBGO, we have created a bounty pool to support contributors by giving away $BBG tokens.
Check the details in [$BBG Contract Page](contracts/README.md) and our [official website](https://bbgo.finance)

Expand Down Expand Up @@ -584,4 +599,4 @@ See [Contributing](./CONTRIBUTING.md)

## License

MIT License
AGPL License
24 changes: 24 additions & 0 deletions config/autoborrow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
exchangeStrategies:
- on: binance
autoborrow:
interval: 30m
autoRepayWhenDeposit: true

# minMarginRatio for triggering auto borrow
# we trigger auto borrow only when the margin ratio is above the number
minMarginLevel: 1.5

# maxMarginRatio for stop auto-repay
# if the margin ratio is high enough, we don't have the urge to repay
maxMarginLevel: 10.0

assets:
- asset: ETH
low: 3.0
maxQuantityPerBorrow: 1.0
maxTotalBorrow: 10.0
- asset: USDT
low: 1000.0
maxQuantityPerBorrow: 100.0
maxTotalBorrow: 10.0
18 changes: 10 additions & 8 deletions config/ewo_dgtrd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ exchangeStrategies:

- on: binance
ewo_dgtrd:
symbol: NEARUSDT
interval: 15m
symbol: MATICUSDT
interval: 30m
useEma: false
useSma: false
sigWin: 3
stoploss: 2%
callback: 1%
useHeikinAshi: true
disableShortStop: true
#stops:
#- trailingStop:
# callbackRate: 5.1%
Expand All @@ -33,16 +33,18 @@ sync:
sessions:
- binance
symbols:
- NEARUSDT
- MATICUSDT

backtest:
startTime: "2022-03-03"
endTime: "2022-04-14"
startTime: "2022-04-14"
endTime: "2022-04-28"
symbols:
- NEARUSDT
- MATICUSDT
sessions: [binance]
account:
binance:
makerFeeRate: 0
takerFeeRate: 0
balances:
NEAR: 0
MATIC: 500
USDT: 10000
8 changes: 0 additions & 8 deletions config/sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ sessions:
exchange: max
envVarPrefix: max

okex:
exchange: okex
envVarPrefix: okex

kucoin:
exchange: kucoin
envVarPrefix: kucoin

sync:
# userDataStream is used to sync the trading data in real-time
# it uses the websocket connection to insert the trades
Expand Down
2 changes: 1 addition & 1 deletion doc/commands/bbgo.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ bbgo [flags]
* [bbgo userdatastream](bbgo_userdatastream.md) - Listen to session events (orderUpdate, tradeUpdate, balanceUpdate, balanceSnapshot)
* [bbgo version](bbgo_version.md) - show version name

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_account.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ bbgo account [--session SESSION] [flags]

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_backtest.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ bbgo backtest [flags]

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_balances.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ bbgo balances [--session SESSION] [flags]

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_build.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ bbgo build [flags]

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_cancel-order.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ bbgo cancel-order [flags]

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_deposits.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ bbgo deposits [flags]

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_execute-order.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ bbgo execute-order --session SESSION --symbol SYMBOL --side SIDE --target-quanti

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_get-order.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ bbgo get-order --session SESSION --order-id ORDER_ID [flags]

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_kline.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ bbgo kline [flags]

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_list-orders.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ bbgo list-orders open|closed --session SESSION --symbol SYMBOL [flags]

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_market.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ bbgo market [flags]

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_orderbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ bbgo orderbook --session=[exchange_name] --symbol=[pair_name] [flags]

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_orderupdate.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ bbgo orderupdate [flags]

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_pnl.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ bbgo pnl [flags]

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_run.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ bbgo run [flags]

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_submit-order.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ bbgo submit-order --session SESSION --symbol SYMBOL --side SIDE --quantity QUANT

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_sync.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ bbgo sync --session=[exchange_name] --symbol=[pair_name] [--since=yyyy/mm/dd] [f

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_trades.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ bbgo trades --session=[exchange_name] --symbol=[pair_name] [flags]

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_tradeupdate.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ bbgo tradeupdate --session=[exchange_name] [flags]

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_transfer-history.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ bbgo transfer-history [flags]

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_userdatastream.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ bbgo userdatastream [flags]

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
2 changes: 1 addition & 1 deletion doc/commands/bbgo_version.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ bbgo version [flags]

* [bbgo](bbgo.md) - bbgo is a crypto trading bot

###### Auto generated by spf13/cobra on 17-Apr-2022
###### Auto generated by spf13/cobra on 1-May-2022
23 changes: 23 additions & 0 deletions doc/release/v1.31.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Fixes

- Fixed and improved the trade sync.
- Fixed MAX order history sync with the new order history api.

## Features

- Added more sync options for deposit history, withdraw history and reward history.
- Added strategy controller for suspend, resume a strategy. thanks @andycheng123!
- Added more indicators. thanks @zenixls2!

## Strategy

- Added autoborrow strategy (this is currently for binance only)
- Added factorzoo strategy. thanks @austin362667!
- Added elliott wave oscillator strategy. thhanks @zenixls2!

## Internal

- Upgraded rockhopper migration library for the new APIs.
- Added mutex lock to the account object.
- Refactored and rewrote the MAX API with requestgen.
- Added grpc python client, thanks @narumiruna!
4 changes: 4 additions & 0 deletions doc/release/v1.31.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## Fixes

- Fixed margin order/trade sync.
- Fixed initial bollinger indicator band width setup.
12 changes: 0 additions & 12 deletions doc/release/v2.0.0.md

This file was deleted.

19 changes: 9 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ require (
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/adshao/go-binance/v2 v2.3.5
github.com/c9s/requestgen v1.1.1-0.20211230171502-c042072e23cd
github.com/c9s/rockhopper v1.2.1-0.20210217093258-2661955904a9
github.com/c9s/rockhopper v1.2.1-0.20220426104534-f27cbb09846c
github.com/codingconcepts/env v0.0.0-20200821220118-a8fbf8d84482
github.com/fatih/color v1.13.0
github.com/gin-contrib/cors v1.3.1
github.com/gin-gonic/gin v1.7.0
github.com/go-redis/redis/v8 v8.8.0
github.com/go-sql-driver/mysql v1.5.0
github.com/go-sql-driver/mysql v1.6.0
github.com/google/uuid v1.3.0
github.com/gorilla/websocket v1.5.0
github.com/jmoiron/sqlx v1.3.4
Expand Down Expand Up @@ -55,7 +55,7 @@ require (
github.com/cockroachdb/apd v1.1.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/denisenkom/go-mssqldb v0.9.0 // indirect
github.com/denisenkom/go-mssqldb v0.12.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
Expand All @@ -64,20 +64,20 @@ require (
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/go-playground/validator/v10 v10.4.1 // indirect
github.com/go-test/deep v1.0.6 // indirect
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe // indirect
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/lestrrat-go/strftime v1.0.0 // indirect
github.com/lib/pq v1.9.0 // indirect
github.com/lib/pq v1.10.5 // indirect
github.com/magiconair/properties v1.8.4 // indirect
github.com/mattn/go-colorable v0.1.9 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-sqlite3 v1.14.10 // indirect
github.com/mattn/go-sqlite3 v1.14.12 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
Expand All @@ -102,14 +102,13 @@ require (
go.opentelemetry.io/otel/metric v0.19.0 // indirect
go.opentelemetry.io/otel/trace v0.19.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
golang.org/x/net v0.0.0-20220403103023-749bd193bc2b // indirect
golang.org/x/sys v0.0.0-20220406163625-3f8b81556e12 // indirect
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.9 // indirect
google.golang.org/genproto v0.0.0-20220405205423-9d709892a2bf // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
nhooyr.io/websocket v1.8.7 // indirect
)
Loading

0 comments on commit 2c9f6d0

Please sign in to comment.