Merge pull request #158 from c9s/minor/ftx-configs

This commit is contained in:
YC 2021-03-15 21:03:27 +08:00 committed by GitHub
commit 2c660b716a
3 changed files with 10 additions and 7 deletions

View File

@ -67,13 +67,19 @@ MAX_API_SECRET=
FTX_API_KEY=
FTX_API_SECRET=
# specify it if credentials are for subaccount
FTX_SUBACCOUNT_NAME=
FTX_SUBACCOUNT=
MYSQL_URL=root@tcp(127.0.0.1:3306)/bbgo?parseTime=true
```
Prepare your dotenv file `.env.local` and BBGO yaml config file `bbgo.yaml`.
The minimal bbgo.yaml could be generated by:
```shell
mkdir config
(cd config && curl -o bbgo.yaml https://raw.githubusercontent.com/c9s/bbgo/main/config/minimal.yaml)
```
To sync your own trade data:
```

View File

@ -14,7 +14,7 @@ import (
_ "github.com/go-sql-driver/mysql"
)
var SupportedExchanges = []types.ExchangeName{"binance", "max"}
var SupportedExchanges = []types.ExchangeName{"binance", "max", "ftx"}
// SingleExchangeStrategy represents the single Exchange strategy
type SingleExchangeStrategy interface {
@ -103,7 +103,7 @@ func (trader *Trader) Configure(userConfig *Config) error {
for _, entry := range userConfig.ExchangeStrategies {
for _, mount := range entry.Mounts {
log.Infof("attaching strategy %T on %s...", entry.Strategy, mount)
if err := trader.AttachStrategyOn(mount, entry.Strategy) ; err != nil {
if err := trader.AttachStrategyOn(mount, entry.Strategy); err != nil {
return err
}
}
@ -131,7 +131,6 @@ func (trader *Trader) Configure(userConfig *Config) error {
return nil
}
// AttachStrategyOn attaches the single exchange strategy on an exchange Session.
// Single exchange strategy is the default behavior.
func (trader *Trader) AttachStrategyOn(session string, strategies ...SingleExchangeStrategy) error {

View File

@ -42,9 +42,8 @@ var balancesCmd = &cobra.Command{
return err
}
environ := bbgo.NewEnvironment()
if err := environ.ConfigureDatabase(ctx) ; err != nil {
if err := environ.ConfigureDatabase(ctx); err != nil {
return err
}
@ -71,4 +70,3 @@ var balancesCmd = &cobra.Command{
return nil
},
}