2023-11-23 08:45:28 +00:00
|
|
|
package dca2
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/c9s/bbgo/pkg/types"
|
2023-11-27 07:55:02 +00:00
|
|
|
"github.com/sirupsen/logrus"
|
2023-11-23 08:45:28 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func (s *Strategy) debugOrders(submitOrders []types.Order) {
|
|
|
|
var sb strings.Builder
|
|
|
|
sb.WriteString("DCA ORDERS[\n")
|
|
|
|
for i, order := range submitOrders {
|
|
|
|
sb.WriteString(fmt.Sprintf("%3d) ", i+1) + order.String() + "\n")
|
|
|
|
}
|
|
|
|
sb.WriteString("] END OF DCA ORDERS")
|
|
|
|
|
|
|
|
s.logger.Info(sb.String())
|
|
|
|
}
|
2023-11-27 07:55:02 +00:00
|
|
|
|
|
|
|
func debugRoundOrders(logger *logrus.Entry, roundName string, round Round) {
|
|
|
|
var sb strings.Builder
|
|
|
|
sb.WriteString("ROUND " + roundName + " [\n")
|
2024-05-29 08:32:18 +00:00
|
|
|
for i, order := range round.TakeProfitOrders {
|
|
|
|
sb.WriteString(fmt.Sprintf("%3d) ", i+1) + order.String() + "\n")
|
|
|
|
}
|
2023-11-27 07:55:02 +00:00
|
|
|
sb.WriteString("------------------------------------------------\n")
|
|
|
|
for i, order := range round.OpenPositionOrders {
|
|
|
|
sb.WriteString(fmt.Sprintf("%3d) ", i+1) + order.String() + "\n")
|
|
|
|
}
|
|
|
|
sb.WriteString("] END OF ROUND")
|
|
|
|
logger.Info(sb.String())
|
|
|
|
}
|