mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
base: simplify naming
This commit is contained in:
parent
62d394d183
commit
c9c058e717
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user