From 565c565af08c59408117191693fc08e3f5de100e Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 26 May 2023 17:46:06 +0800 Subject: [PATCH] test --- rule/self_buy_global.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rule/self_buy_global.go b/rule/self_buy_global.go index 5039432..c36741d 100644 --- a/rule/self_buy_global.go +++ b/rule/self_buy_global.go @@ -47,10 +47,13 @@ func AddOrder(eg *xorm.Engine, req map[string]string) { if zhios_order_relate_utils.StrToFloat64(max.OtherPrice) > 0 { num := int(zhios_order_relate_utils.StrToFloat64(max.OtherPrice) / onemoney) leave = zhios_order_relate_utils.StrToFloat64(max.OtherPrice) - onemoney*float64(num) + if leave < 0 { + leave = 0 + } } nowMoney := leave + price*capitalPoolMul nowNum := int(nowMoney / onemoney) - max.Num = nowNum + max.Num += nowNum max.LeavePrice = zhios_order_relate_utils.Float64ToStrByPrec(zhios_order_relate_utils.StrToFloat64(max.LeavePrice)+zhios_order_relate_utils.StrToFloat64(req["price"]), 3) max.OtherPrice = zhios_order_relate_utils.Float64ToStrByPrec(zhios_order_relate_utils.StrToFloat64(max.OtherPrice)+zhios_order_relate_utils.StrToFloat64(req["price"]), 3) max.UpdateTime = time.Now()