From 705261d2d47f5b1e67d750d36a83185e728807b9 Mon Sep 17 00:00:00 2001 From: narumi Date: Wed, 15 May 2024 23:38:34 +0800 Subject: [PATCH] fix strategy initialization --- pkg/strategy/atrpin/strategy.go | 4 +++- pkg/strategy/random/strategy.go | 4 +++- pkg/strategy/wall/strategy.go | 4 +++- pkg/strategy/xfixedmaker/strategy.go | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pkg/strategy/atrpin/strategy.go b/pkg/strategy/atrpin/strategy.go index bc2529f61..dae310db7 100644 --- a/pkg/strategy/atrpin/strategy.go +++ b/pkg/strategy/atrpin/strategy.go @@ -38,7 +38,9 @@ type Strategy struct { } func (s *Strategy) Initialize() error { - s.Strategy = &common.Strategy{} + if s.Strategy == nil { + s.Strategy = &common.Strategy{} + } return nil } diff --git a/pkg/strategy/random/strategy.go b/pkg/strategy/random/strategy.go index cb62667af..1d9544032 100644 --- a/pkg/strategy/random/strategy.go +++ b/pkg/strategy/random/strategy.go @@ -42,7 +42,9 @@ func (s *Strategy) Defaults() error { } func (s *Strategy) Initialize() error { - s.Strategy = &common.Strategy{} + if s.Strategy == nil { + s.Strategy = &common.Strategy{} + } return nil } diff --git a/pkg/strategy/wall/strategy.go b/pkg/strategy/wall/strategy.go index 39ef033f9..58ef15bc0 100644 --- a/pkg/strategy/wall/strategy.go +++ b/pkg/strategy/wall/strategy.go @@ -65,7 +65,9 @@ type Strategy struct { } func (s *Strategy) Initialize() error { - s.Strategy = &common.Strategy{} + if s.Strategy == nil { + s.Strategy = &common.Strategy{} + } return nil } diff --git a/pkg/strategy/xfixedmaker/strategy.go b/pkg/strategy/xfixedmaker/strategy.go index 01b10b8c4..fe7e2a855 100644 --- a/pkg/strategy/xfixedmaker/strategy.go +++ b/pkg/strategy/xfixedmaker/strategy.go @@ -55,7 +55,9 @@ func (s *Strategy) Defaults() error { } func (s *Strategy) Initialize() error { - s.Strategy = &common.Strategy{} + if s.Strategy == nil { + s.Strategy = &common.Strategy{} + } return nil }