Merge pull request #1512 from c9s/c9s/fix-boll-history-kline-push

FIX: [bollmaker] fix bollinger indicator history kline push
This commit is contained in:
c9s 2024-01-24 16:36:12 +08:00 committed by GitHub
commit cb1133b0e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View File

@ -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...)

View File

@ -38,7 +38,6 @@ 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) {
@ -46,6 +45,8 @@ func BOLL(source types.Float64Source, window int, k float64) *BOLLStream {
s.UpBand.PushAndEmit(mid + band)
s.DownBand.PushAndEmit(mid - band)
})
s.Bind(source, s)
return s
}