grid2: pass logger entry to debugGrid

This commit is contained in:
c9s 2023-02-22 15:16:47 +08:00
parent 9d218d93ac
commit 6dc92bea16
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
2 changed files with 6 additions and 4 deletions

View File

@ -4,12 +4,14 @@ import (
"fmt"
"strings"
"github.com/sirupsen/logrus"
"github.com/c9s/bbgo/pkg/bbgo"
"github.com/c9s/bbgo/pkg/fixedpoint"
"github.com/c9s/bbgo/pkg/types"
)
func debugGrid(grid *Grid, book *bbgo.ActiveOrderBook) {
func debugGrid(logger logrus.FieldLogger, grid *Grid, book *bbgo.ActiveOrderBook) {
var sb strings.Builder
sb.WriteString("================== GRID ORDERS ==================\n")
@ -50,5 +52,5 @@ func debugGrid(grid *Grid, book *bbgo.ActiveOrderBook) {
sb.WriteString("================== END OF GRID ORDERS ===================")
fmt.Println(sb.String())
logger.Infoln(sb.String())
}

View File

@ -1223,7 +1223,7 @@ func (s *Strategy) recoverGridWithOpenOrders(ctx context.Context, historyService
}
}
debugGrid(grid, orderBook)
debugGrid(s.logger, grid, orderBook)
tmpOrders := orderBook.Orders()
@ -1272,7 +1272,7 @@ func (s *Strategy) recoverGridWithOpenOrders(ctx context.Context, historyService
s.logger.Infof("GRID RECOVER COMPLETE")
debugGrid(grid, s.orderExecutor.ActiveMakerOrders())
debugGrid(s.logger, grid, s.orderExecutor.ActiveMakerOrders())
return nil
}