util: remove unused func

This commit is contained in:
c9s 2022-12-26 16:05:21 +08:00
parent c07c3c62a9
commit a66cee9130
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
2 changed files with 1 additions and 29 deletions

View File

@ -52,7 +52,7 @@ func (s *State) SlackAttachment() slack.Attachment {
Title: s.Asset + " Transfer States", Title: s.Asset + " Transfer States",
Fields: []slack.AttachmentField{ Fields: []slack.AttachmentField{
{Title: "Total Number of Transfers", Value: fmt.Sprintf("%d", s.DailyNumberOfTransfers), Short: true}, {Title: "Total Number of Transfers", Value: fmt.Sprintf("%d", s.DailyNumberOfTransfers), Short: true},
{Title: "Total Amount of Transfers", Value: util.FormatFloat(s.DailyAmountOfTransfers.Float64(), 4), Short: true}, {Title: "Total Amount of Transfers", Value: s.DailyAmountOfTransfers.String(), Short: true},
}, },
Footer: templateutil.Render("Since {{ . }}", time.Unix(s.Since, 0).Format(time.RFC822)), Footer: templateutil.Render("Since {{ . }}", time.Unix(s.Since, 0).Format(time.RFC822)),
} }

View File

@ -1,28 +0,0 @@
package util
import (
"strconv"
"github.com/c9s/bbgo/pkg/fixedpoint"
)
const MaxDigits = 18 // MAX_INT64 ~ 9 * 10^18
var Pow10Table = [MaxDigits + 1]int64{
1, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18,
}
func Pow10(n int64) int64 {
if n < 0 || n > MaxDigits {
return 0
}
return Pow10Table[n]
}
func FormatValue(val fixedpoint.Value, prec int) string {
return val.FormatString(prec)
}
func FormatFloat(val float64, prec int) string {
return strconv.FormatFloat(val, 'f', prec, 64)
}