bollmaker: fix settings overriding

This commit is contained in:
Raphanus Lo 2022-09-12 00:27:11 +08:00
parent 1ea8b79654
commit 8286356d3b

View File

@ -29,7 +29,11 @@ type DynamicSpreadSettings struct {
// Initialize dynamic spreads and preload SMAs
func (ds *DynamicSpreadSettings) Initialize(symbol string, session *bbgo.ExchangeSession, neutralBoll, defaultBoll *indicator.BOLL) {
switch {
case ds.Enabled != nil && !*ds.Enabled:
case ds.AmpSpreadSettings != nil:
ds.AmpSpreadSettings.initialize(symbol, session)
case ds.WeightedBollWidthRatioSpreadSettings != nil:
ds.WeightedBollWidthRatioSpreadSettings.initialize(neutralBoll, defaultBoll)
case ds.Enabled != nil && *ds.Enabled:
// backward compatibility
ds.AmpSpreadSettings = &DynamicSpreadAmpSettings{
IntervalWindow: ds.IntervalWindow,
@ -37,10 +41,6 @@ func (ds *DynamicSpreadSettings) Initialize(symbol string, session *bbgo.Exchang
BidSpreadScale: ds.BidSpreadScale,
}
ds.AmpSpreadSettings.initialize(symbol, session)
case ds.AmpSpreadSettings != nil:
ds.AmpSpreadSettings.initialize(symbol, session)
case ds.WeightedBollWidthRatioSpreadSettings != nil:
ds.WeightedBollWidthRatioSpreadSettings.initialize(neutralBoll, defaultBoll)
}
}