mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +00:00
rearrange doc
This commit is contained in:
parent
e1c0296705
commit
07dfae19bb
69
README.md
69
README.md
|
@ -477,15 +477,15 @@ streambook := types.NewStreamBook(symbol)
|
|||
streambook.BindStream(stream)
|
||||
```
|
||||
|
||||
## How To Add A New Exchange
|
||||
|
||||
(TBD)
|
||||
## Deployment
|
||||
|
||||
- [Helm Chart](./doc/deployment/helm-chart.md)
|
||||
- Baremetal machine or a VPS
|
||||
|
||||
## Development
|
||||
|
||||
The overview function flow at bbgo
|
||||
![image info](./assets/overview.svg)
|
||||
- [Adding New Exchange](./doc/development/adding-new-exchange.md)
|
||||
- [Migration](./doc/development/migration.md)
|
||||
|
||||
### Setting up your local repository
|
||||
|
||||
|
@ -497,65 +497,6 @@ The overview function flow at bbgo
|
|||
6. Push your changes to your fork.
|
||||
7. Send a pull request.
|
||||
|
||||
### Adding new migration
|
||||
|
||||
1. The project used rockerhopper for db migration.
|
||||
https://github.com/c9s/rockhopper
|
||||
|
||||
|
||||
2. Create migration files
|
||||
|
||||
```sh
|
||||
rockhopper --config rockhopper_sqlite.yaml create --type sql add_pnl_column
|
||||
rockhopper --config rockhopper_mysql.yaml create --type sql add_pnl_column
|
||||
```
|
||||
|
||||
or you can use the util script:
|
||||
|
||||
```
|
||||
bash utils/generate-new-migration.sh add_pnl_column
|
||||
```
|
||||
|
||||
Be sure to edit both sqlite3 and mysql migration files. ( [Sample](migrations/mysql/20210531234123_add_kline_taker_buy_columns.sql) )
|
||||
|
||||
|
||||
To test the drivers, you have to update the rockhopper_mysql.yaml file to connect your database,
|
||||
then do:
|
||||
|
||||
```sh
|
||||
rockhopper --config rockhopper_sqlite.yaml up
|
||||
rockhopper --config rockhopper_mysql.yaml up
|
||||
```
|
||||
|
||||
Then run the following command to compile the migration files into go files:
|
||||
|
||||
```shell
|
||||
make migrations
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```shell
|
||||
rockhopper compile --config rockhopper_mysql.yaml --output pkg/migrations/mysql
|
||||
rockhopper compile --config rockhopper_sqlite.yaml --output pkg/migrations/sqlite3
|
||||
git add -v pkg/migrations && git commit -m "compile and update migration package" pkg/migrations || true
|
||||
```
|
||||
|
||||
|
||||
If you want to override the DSN and the Driver defined in the YAML config file, you can add some env vars in your dotenv file like this:
|
||||
|
||||
```shell
|
||||
ROCKHOPPER_DRIVER=mysql
|
||||
ROCKHOPPER_DIALECT=mysql
|
||||
ROCKHOPPER_DSN="root:123123@unix(/opt/local/var/run/mysql57/mysqld.sock)/bbgo"
|
||||
```
|
||||
|
||||
And then, run:
|
||||
|
||||
```shell
|
||||
dotenv -f .env.local -- rockhopper --config rockhopper_mysql.yaml up
|
||||
```
|
||||
|
||||
### Setup frontend development environment
|
||||
|
||||
```sh
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
## Helm Chart
|
||||
# Helm Chart
|
||||
|
||||
## Requirement
|
||||
|
||||
- redis (optional, if you need persistence)
|
||||
- docker image (you can use the image from docker hub or build one by yourself)
|
||||
|
||||
## Install
|
||||
|
||||
If you need redis:
|
||||
|
||||
|
@ -74,7 +81,7 @@ helm upgrade bbgo-$INSTANCE ./charts/bbgo
|
|||
helm upgrade --set image.tag=1.15.2 bbgo-$INSTANCE ./charts/bbgo
|
||||
```
|
||||
|
||||
Delete chart:
|
||||
## Delete an installed chart
|
||||
|
||||
```sh
|
||||
helm delete bbgo-$INSTANCE
|
||||
|
|
60
doc/development/migration.md
Normal file
60
doc/development/migration.md
Normal file
|
@ -0,0 +1,60 @@
|
|||
# Migration
|
||||
|
||||
### Adding new migration
|
||||
|
||||
1. The project used rockerhopper for db migration.
|
||||
https://github.com/c9s/rockhopper
|
||||
|
||||
|
||||
2. Create migration files
|
||||
|
||||
```sh
|
||||
rockhopper --config rockhopper_sqlite.yaml create --type sql add_pnl_column
|
||||
rockhopper --config rockhopper_mysql.yaml create --type sql add_pnl_column
|
||||
```
|
||||
|
||||
or you can use the util script:
|
||||
|
||||
```
|
||||
bash utils/generate-new-migration.sh add_pnl_column
|
||||
```
|
||||
|
||||
Be sure to edit both sqlite3 and mysql migration files. ( [Sample](migrations/mysql/20210531234123_add_kline_taker_buy_columns.sql) )
|
||||
|
||||
|
||||
To test the drivers, you have to update the rockhopper_mysql.yaml file to connect your database,
|
||||
then do:
|
||||
|
||||
```sh
|
||||
rockhopper --config rockhopper_sqlite.yaml up
|
||||
rockhopper --config rockhopper_mysql.yaml up
|
||||
```
|
||||
|
||||
Then run the following command to compile the migration files into go files:
|
||||
|
||||
```shell
|
||||
make migrations
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```shell
|
||||
rockhopper compile --config rockhopper_mysql.yaml --output pkg/migrations/mysql
|
||||
rockhopper compile --config rockhopper_sqlite.yaml --output pkg/migrations/sqlite3
|
||||
git add -v pkg/migrations && git commit -m "compile and update migration package" pkg/migrations || true
|
||||
```
|
||||
|
||||
|
||||
If you want to override the DSN and the Driver defined in the YAML config file, you can add some env vars in your dotenv file like this:
|
||||
|
||||
```shell
|
||||
ROCKHOPPER_DRIVER=mysql
|
||||
ROCKHOPPER_DIALECT=mysql
|
||||
ROCKHOPPER_DSN="root:123123@unix(/opt/local/var/run/mysql57/mysqld.sock)/bbgo"
|
||||
```
|
||||
|
||||
And then, run:
|
||||
|
||||
```shell
|
||||
dotenv -f .env.local -- rockhopper --config rockhopper_mysql.yaml up
|
||||
```
|
Loading…
Reference in New Issue
Block a user