From 8314a7e7502d7436d9ee257f9d4b52b28965bc20 Mon Sep 17 00:00:00 2001 From: c9s Date: Sun, 17 Sep 2023 18:03:23 +0800 Subject: [PATCH] types: improve order string format --- pkg/types/order.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkg/types/order.go b/pkg/types/order.go index 5e29fdd36..a24a82a52 100644 --- a/pkg/types/order.go +++ b/pkg/types/order.go @@ -320,9 +320,8 @@ func (o Order) String() string { orderID = strconv.FormatUint(o.OrderID, 10) } - desc := fmt.Sprintf("ORDER %s | %s | %s | %s | %s %-4s | %s/%s @ %s", + desc := fmt.Sprintf("ORDER %s | %s | %s | %s %-4s | %s/%s @ %s", o.Exchange.String(), - o.CreationTime.Time().Local().Format(time.StampMilli), orderID, o.Symbol, o.Type, @@ -335,7 +334,15 @@ func (o Order) String() string { desc += " Stop @ " + o.StopPrice.String() } - return desc + " | " + string(o.Status) + desc += " | " + string(o.Status) + " | " + + if time.Time(o.UpdateTime).IsZero() { + desc += "0/" + time.Time(o.CreationTime).UTC().Format(time.StampMilli) + } else { + desc += time.Time(o.UpdateTime).UTC().Format(time.StampMilli) + "/" + time.Time(o.CreationTime).UTC().Format(time.StampMilli) + } + + return desc } // PlainText is used for telegram-styled messages