mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 23:05:15 +00:00
improve floating number formatting
This commit is contained in:
parent
117b26840e
commit
fbe850b364
|
@ -73,12 +73,12 @@ type Trade struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (trade Trade) String() string {
|
func (trade Trade) String() string {
|
||||||
return fmt.Sprintf("TRADE %s %s %4s %s @ %s orderID %d %s amount %f",
|
return fmt.Sprintf("TRADE %s %s %4s %f @ %f orderID %d %s amount %f",
|
||||||
trade.Exchange.String(),
|
trade.Exchange.String(),
|
||||||
trade.Symbol,
|
trade.Symbol,
|
||||||
trade.Side,
|
trade.Side,
|
||||||
util.FormatFloat(trade.Quantity, 4),
|
trade.Quantity,
|
||||||
util.FormatFloat(trade.Price, 3),
|
trade.Price,
|
||||||
trade.OrderID,
|
trade.OrderID,
|
||||||
trade.Time.Time().Format(time.StampMilli),
|
trade.Time.Time().Format(time.StampMilli),
|
||||||
trade.QuoteQuantity)
|
trade.QuoteQuantity)
|
||||||
|
@ -86,13 +86,13 @@ func (trade Trade) String() string {
|
||||||
|
|
||||||
// PlainText is used for telegram-styled messages
|
// PlainText is used for telegram-styled messages
|
||||||
func (trade Trade) PlainText() string {
|
func (trade Trade) PlainText() string {
|
||||||
return fmt.Sprintf("Trade %s %s %s %s @ %s, amount %s",
|
return fmt.Sprintf("Trade %s %s %s %f @ %f, amount %f",
|
||||||
trade.Exchange.String(),
|
trade.Exchange.String(),
|
||||||
trade.Symbol,
|
trade.Symbol,
|
||||||
trade.Side,
|
trade.Side,
|
||||||
util.FormatFloat(trade.Quantity, 4),
|
trade.Quantity,
|
||||||
util.FormatFloat(trade.Price, 3),
|
trade.Price,
|
||||||
util.FormatFloat(trade.QuoteQuantity, 2))
|
trade.QuoteQuantity)
|
||||||
}
|
}
|
||||||
|
|
||||||
var slackTradeTextTemplate = ":handshake: {{ .Symbol }} {{ .Side }} Trade Execution @ {{ .Price }}"
|
var slackTradeTextTemplate = ":handshake: {{ .Symbol }} {{ .Side }} Trade Execution @ {{ .Price }}"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user