修复:优化创建交易流程代码,将金额修改为保留3位小数点

This commit is contained in:
Ashang
2022-04-04 16:18:31 +08:00
parent 20c576b9bc
commit 68f92dd1b1
10 changed files with 144 additions and 168 deletions
+2 -6
View File
@@ -1,12 +1,11 @@
package task
import (
"fmt"
"github.com/assimon/luuu/config"
"github.com/assimon/luuu/util/http_client"
"github.com/assimon/luuu/util/json"
"github.com/assimon/luuu/util/log"
"strconv"
"github.com/assimon/luuu/util/math"
"time"
)
@@ -56,10 +55,7 @@ func (r UsdtRateJob) Run() {
}
for _, points := range usdtResp.Data.Points {
if len(points.C) > 0 && points.C[0] > 0 {
config.UsdtRate, err = strconv.ParseFloat(fmt.Sprintf("%.2f", points.C[0]), 64)
if err != nil {
log.Sugar.Error("Calculate UsdtRate err:", err.Error())
}
config.UsdtRate = math.MustParsePrecFloat64(points.C[0], 2)
return
}
}