mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
Update README.md
This commit is contained in:
parent
360e99bb7d
commit
f710209274
56
README.md
56
README.md
|
@ -40,7 +40,7 @@ would be great if you can use their referral code as your support to them. :-D
|
||||||
|
|
||||||
The following script will help you set up a config file, dotenv file:
|
The following script will help you set up a config file, dotenv file:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
bash <(curl -s https://raw.githubusercontent.com/c9s/bbgo/main/scripts/setup-grid.sh)
|
bash <(curl -s https://raw.githubusercontent.com/c9s/bbgo/main/scripts/setup-grid.sh)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ go get -u github.com/c9s/bbgo/cmd/bbgo
|
||||||
|
|
||||||
Add your dotenv file:
|
Add your dotenv file:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
# if you have one
|
# if you have one
|
||||||
BINANCE_API_KEY=
|
BINANCE_API_KEY=
|
||||||
BINANCE_API_SECRET=
|
BINANCE_API_SECRET=
|
||||||
|
@ -82,20 +82,20 @@ Prepare your dotenv file `.env.local` and BBGO yaml config file `bbgo.yaml`.
|
||||||
|
|
||||||
The minimal bbgo.yaml could be generated by:
|
The minimal bbgo.yaml could be generated by:
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
curl -o bbgo.yaml https://raw.githubusercontent.com/c9s/bbgo/main/config/minimal.yaml
|
curl -o bbgo.yaml https://raw.githubusercontent.com/c9s/bbgo/main/config/minimal.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
To sync your own trade data:
|
To sync your own trade data:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
bbgo sync --session max
|
bbgo sync --session max
|
||||||
bbgo sync --session binance
|
bbgo sync --session binance
|
||||||
```
|
```
|
||||||
|
|
||||||
If you want to switch to other dotenv file, you can add an `--dotenv` option or `--config`:
|
If you want to switch to other dotenv file, you can add an `--dotenv` option or `--config`:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
bbgo sync --dotenv .env.dev --config config/grid.yaml --session binance
|
bbgo sync --dotenv .env.dev --config config/grid.yaml --session binance
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -145,14 +145,14 @@ Botfather will response your a bot token. *Keep bot token safe*
|
||||||
|
|
||||||
Set `TELEGRAM_BOT_TOKEN` in the `.env.local` file, e.g.,
|
Set `TELEGRAM_BOT_TOKEN` in the `.env.local` file, e.g.,
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
TELEGRAM_BOT_TOKEN=347374838:ABFTjfiweajfiawoejfiaojfeijoaef
|
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,
|
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.,
|
you can set `TELEGRAM_AUTH_TOKEN` in the `.env.local` file, e.g.,
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
TELEGRAM_BOT_AUTH_TOKEN=itsme55667788
|
TELEGRAM_BOT_AUTH_TOKEN=itsme55667788
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ Done! your notifications will be routed to the telegram chat.
|
||||||
|
|
||||||
Put your slack bot token in the .env.local file:
|
Put your slack bot token in the .env.local file:
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
SLACK_TOKEN=xxoox
|
SLACK_TOKEN=xxoox
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ and asset calculation.
|
||||||
|
|
||||||
To use MySQL database for data syncing, first you need to install your mysql server:
|
To use MySQL database for data syncing, first you need to install your mysql server:
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
# For Ubuntu Linux
|
# For Ubuntu Linux
|
||||||
sudo apt-get install -y mysql-server
|
sudo apt-get install -y mysql-server
|
||||||
```
|
```
|
||||||
|
@ -193,13 +193,13 @@ Or [run it in docker](https://hub.docker.com/_/mysql)
|
||||||
|
|
||||||
Create your mysql database:
|
Create your mysql database:
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
mysql -uroot -e "CREATE DATABASE bbgo CHARSET utf8"
|
mysql -uroot -e "CREATE DATABASE bbgo CHARSET utf8"
|
||||||
```
|
```
|
||||||
|
|
||||||
Then put these environment variables in your `.env.local` file:
|
Then put these environment variables in your `.env.local` file:
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
DB_DRIVER=mysql
|
DB_DRIVER=mysql
|
||||||
DB_DSN=root@tcp(127.0.0.1:3306)/bbgo
|
DB_DSN=root@tcp(127.0.0.1:3306)/bbgo
|
||||||
```
|
```
|
||||||
|
@ -208,7 +208,7 @@ DB_DSN=root@tcp(127.0.0.1:3306)/bbgo
|
||||||
|
|
||||||
Just put these environment variables in your `.env.local` file:
|
Just put these environment variables in your `.env.local` file:
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
DB_DRIVER=sqlite3
|
DB_DRIVER=sqlite3
|
||||||
DB_DSN=bbgo.sqlite3
|
DB_DSN=bbgo.sqlite3
|
||||||
```
|
```
|
||||||
|
@ -316,14 +316,14 @@ import (
|
||||||
|
|
||||||
Create your go package, and initialize the repository with `go mod` and add bbgo as a dependency:
|
Create your go package, and initialize the repository with `go mod` and add bbgo as a dependency:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
go mod init
|
go mod init
|
||||||
go get github.com/c9s/bbgo@main
|
go get github.com/c9s/bbgo@main
|
||||||
```
|
```
|
||||||
|
|
||||||
Write your own strategy in the strategy file:
|
Write your own strategy in the strategy file:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
vim strategy.go
|
vim strategy.go
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ You can grab the skeleton strategy from <https://github.com/c9s/bbgo/blob/main/p
|
||||||
|
|
||||||
Now add your config:
|
Now add your config:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
mkdir config
|
mkdir config
|
||||||
(cd config && curl -o bbgo.yaml https://raw.githubusercontent.com/c9s/bbgo/main/config/minimal.yaml)
|
(cd config && curl -o bbgo.yaml https://raw.githubusercontent.com/c9s/bbgo/main/config/minimal.yaml)
|
||||||
```
|
```
|
||||||
|
@ -432,20 +432,20 @@ streambook.BindStream(stream)
|
||||||
|
|
||||||
If you need redis:
|
If you need redis:
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
helm repo add bitnami https://charts.bitnami.com/bitnami
|
helm repo add bitnami https://charts.bitnami.com/bitnami
|
||||||
helm install redis bitnami/redis
|
helm install redis bitnami/redis
|
||||||
```
|
```
|
||||||
|
|
||||||
To get the dynamically generated redis password, you can use the following command:
|
To get the dynamically generated redis password, you can use the following command:
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
export REDIS_PASSWORD=$(kubectl get secret --namespace bbgo redis -o jsonpath="{.data.redis-password}" | base64 --decode)
|
export REDIS_PASSWORD=$(kubectl get secret --namespace bbgo redis -o jsonpath="{.data.redis-password}" | base64 --decode)
|
||||||
```
|
```
|
||||||
|
|
||||||
Prepare your docker image locally (you can also use the docker image from docker hub):
|
Prepare your docker image locally (you can also use the docker image from docker hub):
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
make docker DOCKER_TAG=1.16.0
|
make docker DOCKER_TAG=1.16.0
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -453,52 +453,52 @@ The docker tag version number is from the file [Chart.yaml](charts/bbgo/Chart.ya
|
||||||
|
|
||||||
Choose your instance name:
|
Choose your instance name:
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
export INSTANCE=grid
|
export INSTANCE=grid
|
||||||
```
|
```
|
||||||
|
|
||||||
Prepare your secret:
|
Prepare your secret:
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
kubectl create secret generic bbgo-$INSTANCE --from-env-file .env.local
|
kubectl create secret generic bbgo-$INSTANCE --from-env-file .env.local
|
||||||
```
|
```
|
||||||
|
|
||||||
Configure your config file, the chart defaults to read config/bbgo.yaml to create a configmap:
|
Configure your config file, the chart defaults to read config/bbgo.yaml to create a configmap:
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
cp config/grid.yaml bbgo-$INSTANCE.yaml
|
cp config/grid.yaml bbgo-$INSTANCE.yaml
|
||||||
vim bbgo-$INSTANCE.yaml
|
vim bbgo-$INSTANCE.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
Prepare your configmap:
|
Prepare your configmap:
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
kubectl create configmap bbgo-$INSTANCE --from-file=bbgo.yaml=bbgo-$INSTANCE.yaml
|
kubectl create configmap bbgo-$INSTANCE --from-file=bbgo.yaml=bbgo-$INSTANCE.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
Install chart with the preferred release name, the release name maps to the previous secret we just created, that
|
Install chart with the preferred release name, the release name maps to the previous secret we just created, that
|
||||||
is, `bbgo-grid`:
|
is, `bbgo-grid`:
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
helm install --set existingConfigmap=bbgo-$INSTANCE bbgo-$INSTANCE ./charts/bbgo
|
helm install --set existingConfigmap=bbgo-$INSTANCE bbgo-$INSTANCE ./charts/bbgo
|
||||||
```
|
```
|
||||||
|
|
||||||
To use the latest version:
|
To use the latest version:
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
helm install --set existingConfigmap=bbgo-$INSTANCE --set image.tag=latest bbgo-$INSTANCE ./charts/bbgo
|
helm install --set existingConfigmap=bbgo-$INSTANCE --set image.tag=latest bbgo-$INSTANCE ./charts/bbgo
|
||||||
```
|
```
|
||||||
|
|
||||||
To upgrade:
|
To upgrade:
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
helm upgrade bbgo-$INSTANCE ./charts/bbgo
|
helm upgrade bbgo-$INSTANCE ./charts/bbgo
|
||||||
helm upgrade --set image.tag=1.15.2 bbgo-$INSTANCE ./charts/bbgo
|
helm upgrade --set image.tag=1.15.2 bbgo-$INSTANCE ./charts/bbgo
|
||||||
```
|
```
|
||||||
|
|
||||||
Delete chart:
|
Delete chart:
|
||||||
|
|
||||||
```shell
|
```sh
|
||||||
helm delete bbgo-$INSTANCE
|
helm delete bbgo-$INSTANCE
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -531,14 +531,14 @@ Be sure to edit both sqlite3 and mysql migration files.
|
||||||
|
|
||||||
To test the drivers, you can do:
|
To test the drivers, you can do:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
rockhopper --config rockhopper_sqlite.yaml up
|
rockhopper --config rockhopper_sqlite.yaml up
|
||||||
rockhopper --config rockhopper_mysql.yaml up
|
rockhopper --config rockhopper_mysql.yaml up
|
||||||
```
|
```
|
||||||
|
|
||||||
### Setup frontend development environment
|
### Setup frontend development environment
|
||||||
|
|
||||||
```
|
```sh
|
||||||
cd frontend
|
cd frontend
|
||||||
yarn install
|
yarn install
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue
Block a user