diff --git a/pkg/strategy/base/strategy.go b/pkg/strategy/base/strategy.go index 2a7ce1cca..9515a7ba3 100644 --- a/pkg/strategy/base/strategy.go +++ b/pkg/strategy/base/strategy.go @@ -7,8 +7,8 @@ import ( "github.com/c9s/bbgo/pkg/types" ) -// LongShortStrategy provides the core functionality that is required by a long/short strategy. -type LongShortStrategy struct { +// Strategy provides the core functionality that is required by a long/short strategy. +type Strategy struct { Position *types.Position `json:"position,omitempty" persistence:"position"` ProfitStats *types.ProfitStats `json:"profitStats,omitempty" persistence:"profit_stats"` @@ -20,7 +20,7 @@ type LongShortStrategy struct { OrderExecutor *bbgo.GeneralOrderExecutor } -func (s *LongShortStrategy) Setup(ctx context.Context, environ *bbgo.Environment, session *bbgo.ExchangeSession, market types.Market, strategyID, instanceID string) { +func (s *Strategy) Setup(ctx context.Context, environ *bbgo.Environment, session *bbgo.ExchangeSession, market types.Market, strategyID, instanceID string) { s.parent = ctx s.ctx, s.cancel = context.WithCancel(ctx) diff --git a/pkg/strategy/scmaker/strategy.go b/pkg/strategy/scmaker/strategy.go index 6e5a9ad53..5af19703a 100644 --- a/pkg/strategy/scmaker/strategy.go +++ b/pkg/strategy/scmaker/strategy.go @@ -37,7 +37,7 @@ func init() { // Strategy scmaker is a stable coin market maker type Strategy struct { - *base.LongShortStrategy + *base.Strategy Environment *bbgo.Environment Market types.Market @@ -100,8 +100,8 @@ func (s *Strategy) Subscribe(session *bbgo.ExchangeSession) { } func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, session *bbgo.ExchangeSession) error { - s.LongShortStrategy = &base.LongShortStrategy{} - s.LongShortStrategy.Setup(ctx, s.Environment, session, s.Market, ID, s.InstanceID()) + s.Strategy = &base.Strategy{} + s.Strategy.Setup(ctx, s.Environment, session, s.Market, ID, s.InstanceID()) s.book = types.NewStreamBook(s.Symbol) s.book.BindStream(session.UserDataStream)