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 Apr 21, 2024
2 parents fe8a14f + fe53319 commit 9640735
Show file tree
Hide file tree
Showing 208 changed files with 7,833 additions and 2,207 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ jobs:
redis-version:
- "6.2"
go-version:
- "1.20"
- "1.21"
env:
GITHUB_CI: true
MYSQL_DATABASE: bbgo
MYSQL_USER: "root"
MYSQL_PASSWORD: "root" # pragma: allowlist secret
Expand Down Expand Up @@ -57,7 +58,7 @@ jobs:
go-version: ${{ matrix.go-version }}

- name: Install Migration Tool
run: go install github.com/c9s/rockhopper/cmd/rockhopper@v1.2.1
run: go install github.com/c9s/rockhopper/v2/cmd/rockhopper@latest

- name: Test Migration SQL Files For MySQL
run: |
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/golang-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,23 @@ on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

permissions:
contents: read
pull-requests: read
checks: write

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.21
- uses: actions/checkout@v3
go-version: '1.21'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
version: v1.54
version: 'v1.54'
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: "1.20"
go-version: "1.21"
- name: Install Node
uses: actions/setup-node@v2
with:
Expand Down
20 changes: 20 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"name": "Launch bbgo",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/bbgo",
"cwd": "${workspaceFolder}",
"env": {},
"args": ["backtest", "--debug"],
"showLog": true
}
]
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# First stage container
FROM golang:1.20-alpine3.18 AS builder
FROM golang:1.21-alpine3.18 AS builder
RUN apk add --no-cache git ca-certificates gcc musl-dev libc-dev pkgconfig
# gcc is for github.com/mattn/go-sqlite3
# ADD . $GOPATH/src/github.com/c9s/bbgo
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ Check out the strategy directory [strategy](pkg/strategy) for all built-in strat
- `irr` - return rate strategy.
- `drift` - drift strategy.
- `grid2` - the second-generation grid strategy.
- `rebalance` - rebalances your portfolio based on target weights. [rebalance](pkg/strategy/rebalance). See [document](./doc/strategy/rebalance.md).

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
Expand Down
4 changes: 2 additions & 2 deletions config/autobuy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ exchangeStrategies:
symbol: MAXTWD
schedule: "@every 1s"
threshold: 200
# price type: buy, sell, last or mid
priceType: buy
# price type: LAST, BUY, SELL, MID, TAKER, MAKER
priceType: BUY

# order quantity or amount
# quantity: 100
Expand Down
2 changes: 2 additions & 0 deletions config/rebalance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ exchangeStrategies:
threshold: 1%
maxAmount: 1_000 # max amount to buy or sell per order
orderType: LIMIT_MAKER # LIMIT, LIMIT_MAKER or MARKET
priceType: MAKER # LAST, MID, TAKER or MAKER
balanceType: TOTAL
dryRun: true
onStart: true
2 changes: 1 addition & 1 deletion contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Create and modify the following files in this directory, the secret key inside t

```bash
npm i
# if you want to develope in localhost, try to run npm run devserver separately
# if you want to develop in localhost, try to run npm run devserver separately
# ex: npm run devserver
# it will give you a set of secrets and account addresses
```
Expand Down
2 changes: 1 addition & 1 deletion doc/commands/bbgo.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,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 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
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 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
2 changes: 1 addition & 1 deletion doc/commands/bbgo_backtest.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ bbgo backtest [flags]

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

###### Auto generated by spf13/cobra on 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
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 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
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 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
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 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
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 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
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 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
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 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
2 changes: 1 addition & 1 deletion doc/commands/bbgo_hoptimize.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ bbgo hoptimize [flags]

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

###### Auto generated by spf13/cobra on 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
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 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
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 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
2 changes: 1 addition & 1 deletion doc/commands/bbgo_margin.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ margin related history
* [bbgo margin loans](bbgo_margin_loans.md) - query loans history
* [bbgo margin repays](bbgo_margin_repays.md) - query repay history

###### Auto generated by spf13/cobra on 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
2 changes: 1 addition & 1 deletion doc/commands/bbgo_margin_interests.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ bbgo margin interests --session=SESSION_NAME --asset=ASSET [flags]

* [bbgo margin](bbgo_margin.md) - margin related history

###### Auto generated by spf13/cobra on 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
2 changes: 1 addition & 1 deletion doc/commands/bbgo_margin_loans.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ bbgo margin loans --session=SESSION_NAME --asset=ASSET [flags]

* [bbgo margin](bbgo_margin.md) - margin related history

###### Auto generated by spf13/cobra on 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
2 changes: 1 addition & 1 deletion doc/commands/bbgo_margin_repays.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ bbgo margin repays --session=SESSION_NAME --asset=ASSET [flags]

* [bbgo margin](bbgo_margin.md) - margin related history

###### Auto generated by spf13/cobra on 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
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 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
2 changes: 1 addition & 1 deletion doc/commands/bbgo_optimize.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ bbgo optimize [flags]

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

###### Auto generated by spf13/cobra on 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
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 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
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 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
2 changes: 1 addition & 1 deletion doc/commands/bbgo_pnl.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ bbgo pnl [flags]

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

###### Auto generated by spf13/cobra on 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
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 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
2 changes: 1 addition & 1 deletion doc/commands/bbgo_submit-order.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,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 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
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/d

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

###### Auto generated by spf13/cobra on 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
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 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
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 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
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 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
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 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
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 29-Jan-2024
###### Auto generated by spf13/cobra on 19-Mar-2024
2 changes: 1 addition & 1 deletion doc/configuration/envvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ MAX_QUERY_CLOSED_ORDERS_NUM_OF_PAGES=10


# MAX_QUERY_CLOSED_ORDERS_LIMIT=[limit per query]
# using defualt limit 1000 might cause the server response timeout, you can decrease this limit to prevent this kind of error.
# using default limit 1000 might cause the server response timeout, you can decrease this limit to prevent this kind of error.
# default = 1000
MAX_QUERY_CLOSED_ORDERS_LIMIT=500

Expand Down
Loading

0 comments on commit 9640735

Please sign in to comment.