c9s / bbgo

The modern cryptocurrency trading bot framework written in Go.
https://bbgo.finance
GNU Affero General Public License v3.0
1.15k stars 277 forks source link

telegram order price wrong truncation #1624

Closed EliasM108 closed 1 month ago

EliasM108 commented 2 months ago

I got my bbgo bot connected to telegram to receive order changes, but the buy and the sell price gets truncated to the second decimal.

Example of current notification Order binance AEURUSDT LIMIT SELL @ 1.07 0.00/20.000 -> NEW

How it should look like Order binance AEURUSDT LIMIT SELL @ 1.0705 0.00/20.000 -> NEW

zenixls2 commented 1 month ago

Right now this is formatted using the following source code:

func (o Order) PlainText() string {
    return fmt.Sprintf("Order %s %s %s %s @ %s %s/%s -> %s",
        o.Exchange.String(),
        o.Symbol,
        o.Type,
        o.Side,
        o.Price.FormatString(2),
        o.ExecutedQuantity.FormatString(2),
        o.Quantity.FormatString(4),
        o.Status)
}

so it will definitely be truncated to two decimals. @c9s do we have any specific reason that should present the number in this format?

zenixls2 commented 1 month ago

Seems like originated from https://github.com/c9s/bbgo/commit/f4ef19e5d6ae08ab2aeb21b6dd2c1456575b2f25 and slack msg already gets fixed. I think this part needs to be updated as well.