diff --git a/pkg/strategy/atrpin/strategy.go b/pkg/strategy/atrpin/strategy.go index cd817fa69..14653f4cb 100644 --- a/pkg/strategy/atrpin/strategy.go +++ b/pkg/strategy/atrpin/strategy.go @@ -20,7 +20,7 @@ func init() { } type Strategy struct { - *common.Strategy + common.Strategy Environment *bbgo.Environment Market types.Market @@ -62,7 +62,6 @@ func (s *Strategy) Defaults() error { } func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, session *bbgo.ExchangeSession) error { - s.Strategy = &common.Strategy{} s.Strategy.Initialize(ctx, s.Environment, session, s.Market, ID, s.InstanceID()) atr := session.Indicators(s.Symbol).ATR(s.Interval, s.Window) diff --git a/pkg/strategy/dca2/strategy.go b/pkg/strategy/dca2/strategy.go index 597eb69da..a91d3fd3b 100644 --- a/pkg/strategy/dca2/strategy.go +++ b/pkg/strategy/dca2/strategy.go @@ -26,7 +26,7 @@ func init() { } type Strategy struct { - *common.Strategy + common.Strategy Environment *bbgo.Environment Market types.Market @@ -101,7 +101,6 @@ func (s *Strategy) Subscribe(session *bbgo.ExchangeSession) { } func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.ExchangeSession) error { - s.Strategy = &common.Strategy{} s.Strategy.Initialize(ctx, s.Environment, session, s.Market, ID, s.InstanceID()) instanceID := s.InstanceID() diff --git a/pkg/strategy/fixedmaker/strategy.go b/pkg/strategy/fixedmaker/strategy.go index 48748370d..7b0f6fec9 100644 --- a/pkg/strategy/fixedmaker/strategy.go +++ b/pkg/strategy/fixedmaker/strategy.go @@ -23,7 +23,7 @@ func init() { // Fixed spread market making strategy type Strategy struct { - *common.Strategy + common.Strategy Environment *bbgo.Environment Market types.Market @@ -77,7 +77,6 @@ func (s *Strategy) Subscribe(session *bbgo.ExchangeSession) { } func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.ExchangeSession) error { - s.Strategy = &common.Strategy{} s.Strategy.Initialize(ctx, s.Environment, session, s.Market, ID, s.InstanceID()) s.activeOrderBook = bbgo.NewActiveOrderBook(s.Symbol) diff --git a/pkg/strategy/liquiditymaker/strategy.go b/pkg/strategy/liquiditymaker/strategy.go index 9d90e8fed..21af78dd4 100644 --- a/pkg/strategy/liquiditymaker/strategy.go +++ b/pkg/strategy/liquiditymaker/strategy.go @@ -32,7 +32,7 @@ func init() { // - place enough total liquidity amount on the order book, for example, 20k USDT value liquidity on both sell and buy // - ensure the spread by placing the orders from the mid price (or the last trade price) type Strategy struct { - *common.Strategy + common.Strategy Environment *bbgo.Environment Market types.Market @@ -81,7 +81,6 @@ func (s *Strategy) Subscribe(session *bbgo.ExchangeSession) { } func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.ExchangeSession) error { - s.Strategy = &common.Strategy{} s.Strategy.Initialize(ctx, s.Environment, session, s.Market, ID, s.InstanceID()) s.orderGenerator = &LiquidityOrderGenerator{ diff --git a/pkg/strategy/random/strategy.go b/pkg/strategy/random/strategy.go index 96b56cb5a..40ed6026b 100644 --- a/pkg/strategy/random/strategy.go +++ b/pkg/strategy/random/strategy.go @@ -23,7 +23,7 @@ func init() { } type Strategy struct { - *common.Strategy + common.Strategy Environment *bbgo.Environment Market types.Market @@ -67,7 +67,6 @@ func (s *Strategy) Validate() error { func (s *Strategy) Subscribe(session *bbgo.ExchangeSession) {} func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.ExchangeSession) error { - s.Strategy = &common.Strategy{} s.Strategy.Initialize(ctx, s.Environment, session, s.Market, s.ID(), s.InstanceID()) session.UserDataStream.OnStart(func() { diff --git a/pkg/strategy/rsicross/strategy.go b/pkg/strategy/rsicross/strategy.go index eb6c055eb..0993201eb 100644 --- a/pkg/strategy/rsicross/strategy.go +++ b/pkg/strategy/rsicross/strategy.go @@ -9,7 +9,7 @@ import ( "github.com/c9s/bbgo/pkg/bbgo" "github.com/c9s/bbgo/pkg/fixedpoint" - "github.com/c9s/bbgo/pkg/indicator/v2" + indicatorv2 "github.com/c9s/bbgo/pkg/indicator/v2" "github.com/c9s/bbgo/pkg/strategy/common" "github.com/c9s/bbgo/pkg/types" ) @@ -21,7 +21,7 @@ func init() { } type Strategy struct { - *common.Strategy + common.Strategy Environment *bbgo.Environment Market types.Market @@ -49,7 +49,6 @@ func (s *Strategy) Subscribe(session *bbgo.ExchangeSession) { } func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, session *bbgo.ExchangeSession) error { - s.Strategy = &common.Strategy{} s.Strategy.Initialize(ctx, s.Environment, session, s.Market, ID, s.InstanceID()) fastRsi := session.Indicators(s.Symbol).RSI(types.IntervalWindow{Interval: s.Interval, Window: s.FastWindow}) diff --git a/pkg/strategy/scmaker/strategy.go b/pkg/strategy/scmaker/strategy.go index 79e3f8956..fffe9cbc2 100644 --- a/pkg/strategy/scmaker/strategy.go +++ b/pkg/strategy/scmaker/strategy.go @@ -34,7 +34,7 @@ func init() { // Strategy scmaker is a stable coin market maker type Strategy struct { - *common.Strategy + common.Strategy Environment *bbgo.Environment Market types.Market @@ -88,7 +88,6 @@ func (s *Strategy) Subscribe(session *bbgo.ExchangeSession) { } func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.ExchangeSession) error { - s.Strategy = &common.Strategy{} s.Strategy.Initialize(ctx, s.Environment, session, s.Market, ID, s.InstanceID()) s.book = types.NewStreamBook(s.Symbol) diff --git a/pkg/strategy/wall/strategy.go b/pkg/strategy/wall/strategy.go index 0967b241a..83b825f11 100644 --- a/pkg/strategy/wall/strategy.go +++ b/pkg/strategy/wall/strategy.go @@ -30,7 +30,7 @@ func init() { } type Strategy struct { - *common.Strategy + common.Strategy Environment *bbgo.Environment Market types.Market @@ -235,7 +235,6 @@ func (s *Strategy) placeWallOrders(ctx context.Context, orderExecutor bbgo.Order } func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.ExchangeSession) error { - s.Strategy = &common.Strategy{} s.Strategy.Initialize(ctx, s.Environment, session, s.Market, ID, s.InstanceID()) // initial required information diff --git a/pkg/strategy/xfixedmaker/strategy.go b/pkg/strategy/xfixedmaker/strategy.go index 2e6f927f1..be5ca3d3f 100644 --- a/pkg/strategy/xfixedmaker/strategy.go +++ b/pkg/strategy/xfixedmaker/strategy.go @@ -23,7 +23,7 @@ func init() { // Fixed spread market making strategy type Strategy struct { - *common.Strategy + common.Strategy Environment *bbgo.Environment @@ -109,7 +109,6 @@ func (s *Strategy) CrossRun(ctx context.Context, _ bbgo.OrderExecutionRouter, se } s.market = market - s.Strategy = &common.Strategy{} s.Strategy.Initialize(ctx, s.Environment, tradingSession, s.market, ID, s.InstanceID()) s.orderPriceRiskControl = NewOrderPriceRiskControl(