Merge pull request #933 from COLDTURNIP/fix/bollmaker_dyn_spread_setting_backward_compatibility

bollmaker: fix backward compatibility of dynamic spread settings
This commit is contained in:
Yo-An Lin 2022-09-11 23:20:24 +08:00 committed by GitHub
commit 1ea8b79654
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,13 @@ type DynamicSpreadSettings struct {
func (ds *DynamicSpreadSettings) Initialize(symbol string, session *bbgo.ExchangeSession, neutralBoll, defaultBoll *indicator.BOLL) {
switch {
case ds.Enabled != nil && !*ds.Enabled:
// do nothing
// backward compatibility
ds.AmpSpreadSettings = &DynamicSpreadAmpSettings{
IntervalWindow: ds.IntervalWindow,
AskSpreadScale: ds.AskSpreadScale,
BidSpreadScale: ds.BidSpreadScale,
}
ds.AmpSpreadSettings.initialize(symbol, session)
case ds.AmpSpreadSettings != nil:
ds.AmpSpreadSettings.initialize(symbol, session)
case ds.WeightedBollWidthRatioSpreadSettings != nil: