mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 17:13:51 +00:00
Merge pull request #165 from Larry850806/remove-useless-code-in-balances-cmd
This commit is contained in:
commit
06381c250b
|
@ -33,19 +33,24 @@ var balancesCmd = &cobra.Command{
|
||||||
return errors.New("--config option is required")
|
return errors.New("--config option is required")
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := os.Stat(configFile); os.IsNotExist(err) {
|
// if config file exists, use the config loaded from the config file.
|
||||||
|
// otherwise, use a empty config object
|
||||||
|
var userConfig *bbgo.Config
|
||||||
|
if _, err := os.Stat(configFile); err == nil {
|
||||||
|
// load successfully
|
||||||
|
userConfig, err = bbgo.Load(configFile, false)
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
} else if os.IsNotExist(err) {
|
||||||
userConfig, err := bbgo.Load(configFile, false)
|
// config file doesn't exist
|
||||||
if err != nil {
|
userConfig = &bbgo.Config{}
|
||||||
|
} else {
|
||||||
|
// other error
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
environ := bbgo.NewEnvironment()
|
environ := bbgo.NewEnvironment()
|
||||||
if err := environ.ConfigureDatabase(ctx); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := environ.ConfigureExchangeSessions(userConfig); err != nil {
|
if err := environ.ConfigureExchangeSessions(userConfig); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue
Block a user