diff --git a/pkg/cmd/balances.go b/pkg/cmd/balances.go index 85f14b7e3..3694b1da8 100644 --- a/pkg/cmd/balances.go +++ b/pkg/cmd/balances.go @@ -33,12 +33,20 @@ var balancesCmd = &cobra.Command{ return errors.New("--config option is required") } - if _, err := os.Stat(configFile); os.IsNotExist(err) { - return err - } - - userConfig, err := bbgo.Load(configFile, false) - if err != nil { + // 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 + } + } else if os.IsNotExist(err) { + // config file doesn't exist + userConfig = &bbgo.Config{} + } else { + // other error return err }