mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +00:00
import buyandhold strategy
This commit is contained in:
parent
aea6a7c03d
commit
9c751f377a
|
@ -14,12 +14,14 @@ import (
|
|||
"github.com/c9s/bbgo/pkg/config"
|
||||
"github.com/c9s/bbgo/pkg/notifier/slacknotifier"
|
||||
"github.com/c9s/bbgo/pkg/slack/slacklog"
|
||||
|
||||
_ "github.com/c9s/bbgo/pkg/strategy/buyandhold"
|
||||
)
|
||||
|
||||
var errSlackTokenUndefined = errors.New("slack token is not defined.")
|
||||
|
||||
func init() {
|
||||
runCmd.Flags().String("config", "", "strategy config file")
|
||||
runCmd.Flags().String("config", "config/bbgo.yaml", "strategy config file")
|
||||
runCmd.Flags().String("since", "", "pnl since time")
|
||||
RootCmd.AddCommand(runCmd)
|
||||
}
|
||||
|
@ -56,7 +58,6 @@ var runCmd = &cobra.Command{
|
|||
|
||||
log.AddHook(slacklog.NewLogHook(slackToken, viper.GetString("slack-error-channel")))
|
||||
|
||||
// TODO: load channel from config file
|
||||
var notifier = slacknotifier.New(slackToken, viper.GetString("slack-channel"))
|
||||
|
||||
db, err := cmdutil.ConnectMySQL()
|
||||
|
@ -71,11 +72,13 @@ var runCmd = &cobra.Command{
|
|||
|
||||
for _, entry := range userConfig.ExchangeStrategies {
|
||||
for _, mount := range entry.Mounts {
|
||||
log.Infof("attaching strategy %T on %s...", entry.Strategy, mount)
|
||||
trader.AttachStrategyOn(mount, entry.Strategy)
|
||||
}
|
||||
}
|
||||
|
||||
for _, strategy := range userConfig.CrossExchangeStrategies {
|
||||
log.Infof("attaching strategy %T", strategy)
|
||||
trader.AttachCrossExchangeStrategy(strategy)
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ sessions:
|
|||
secretVar: BINANCE_API_SECRET
|
||||
|
||||
exchangeStrategies:
|
||||
- on: binance
|
||||
buyandhold:
|
||||
symbol: "BTCUSDT"
|
||||
interval: "1m"
|
||||
baseQuantity: 0.1
|
||||
minDropPercentage: -0.05
|
||||
- on: binance
|
||||
buyandhold:
|
||||
symbol: "BTCUSDT"
|
||||
interval: "1m"
|
||||
baseQuantity: 0.1
|
||||
minDropPercentage: -0.05
|
||||
|
|
|
@ -100,6 +100,7 @@ func loadExchangeStrategies(stash Stash) (strategies []SingleExchangeStrategyCon
|
|||
exchangeStrategiesConf, ok := stash["exchangeStrategies"]
|
||||
if !ok {
|
||||
return strategies, nil
|
||||
// return nil, errors.New("exchangeStrategies is not defined")
|
||||
}
|
||||
|
||||
configList, ok := exchangeStrategiesConf.([]interface{})
|
||||
|
|
Loading…
Reference in New Issue
Block a user