bbgo_origin/strategies/buyandhold/main.go
2020-10-16 10:09:42 +08:00

30 lines
721 B
Go

package main
import (
"strings"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
"github.com/c9s/bbgo/pkg/bbgo"
"github.com/c9s/bbgo/pkg/strategy/buyandhold"
)
func init() {
// persistent flags for trading environment
bbgo.PersistentFlags(buyandhold.Cmd.PersistentFlags())
}
func main() {
// general viper setup for trading environment
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
viper.AutomaticEnv()
if err := viper.BindPFlags(buyandhold.Cmd.PersistentFlags()); err != nil {
log.WithError(err).Errorf("failed to bind persistent flags. please check the flag settings.")
}
if err := buyandhold.Cmd.Execute(); err != nil {
log.WithError(err).Fatalf("cannot execute command")
}
}