mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
30 lines
721 B
Go
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")
|
|
}
|
|
}
|