base: simplify naming

This commit is contained in:
c9s 2023-07-09 16:04:27 +08:00
parent 62d394d183
commit c9c058e717
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
2 changed files with 6 additions and 6 deletions

View File

@ -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)

View File

@ -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)