Skip to content

Commit

Permalink
Merge pull request c9s#1512 from c9s/c9s/fix-boll-history-kline-push
Browse files Browse the repository at this point in the history
FIX: [bollmaker] fix bollinger indicator history kline push
  • Loading branch information
c9s authored Jan 24, 2024
2 parents f184334 + dd07bc7 commit cb1133b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions pkg/bbgo/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,9 @@ func (environ *Environment) ConfigureDatabase(ctx context.Context, config *Confi
dbDriver = "mysql"
}

if dbDriver == "" {
return fmt.Errorf("either env DB_DRIVER or config.Driver is not set")
// database is optional
if dbDriver == "" || dbDSN == "" {
return nil
}

return environ.ConfigureDatabaseDriver(ctx, dbDriver, dbDSN, extraPkgNames...)
Expand Down
3 changes: 2 additions & 1 deletion pkg/indicator/v2/boll.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ func BOLL(source types.Float64Source, window int, k float64) *BOLLStream {
SMA: sma,
StdDev: stdDev,
}
s.Bind(source, s)

// on band update
s.Float64Series.OnUpdate(func(band float64) {
mid := s.SMA.Last(0)
s.UpBand.PushAndEmit(mid + band)
s.DownBand.PushAndEmit(mid - band)
})

s.Bind(source, s)
return s
}

Expand Down

0 comments on commit cb1133b

Please sign in to comment.