Skip to content

Commit

Permalink
Merge pull request c9s#1527 from c9s/narumi/atrpin/log
Browse files Browse the repository at this point in the history
CHORE: [atrpin] modify position log
  • Loading branch information
narumiruna authored Feb 6, 2024
2 parents 2495258 + a1995db commit 2f40149
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/strategy/atrpin/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ import (
"fmt"
"sync"

log "github.com/sirupsen/logrus"

"github.com/c9s/bbgo/pkg/bbgo"
"github.com/c9s/bbgo/pkg/fixedpoint"
"github.com/c9s/bbgo/pkg/strategy/common"
"github.com/c9s/bbgo/pkg/types"
"github.com/sirupsen/logrus"
)

const ID = "atrpin"

var log = logrus.WithField("strategy", ID)

func init() {
bbgo.RegisterStrategy(ID, &Strategy{})
}
Expand All @@ -38,6 +39,9 @@ type Strategy struct {

func (s *Strategy) Initialize() error {
s.Strategy = &common.Strategy{}

log = log.WithField("symbol", s.Symbol)

return nil
}

Expand Down Expand Up @@ -117,8 +121,9 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
var orderForms []types.SubmitOrder

position := s.Strategy.OrderExecutor.Position()
log.Infof("position: %+v", position)
if !position.IsDust() {
log.Infof("position: %+v", position)
log.Infof("position is not dust")

side := types.SideTypeSell
takerPrice := fixedpoint.Zero
Expand Down

0 comments on commit 2f40149

Please sign in to comment.