1
This commit is contained in:
@ -320,7 +320,7 @@ func (req LineAddPreOrderReq) Valid() error {
|
|||||||
if v.AddType == 1 && v.TakeProfitNumRatio.Cmp(decimal.NewFromInt(100)) < 0 &&
|
if v.AddType == 1 && v.TakeProfitNumRatio.Cmp(decimal.NewFromInt(100)) < 0 &&
|
||||||
v.TakeProfitNumRatio.Cmp(decimal.Zero) > 0 &&
|
v.TakeProfitNumRatio.Cmp(decimal.Zero) > 0 &&
|
||||||
(v.TpTpPriceRatio.IsZero() || v.TpTpPriceRatio.Cmp(decimal.NewFromInt(100)) > 0) {
|
(v.TpTpPriceRatio.IsZero() || v.TpTpPriceRatio.Cmp(decimal.NewFromInt(100)) > 0) {
|
||||||
return errors.New("止盈后止盈价格不正确")
|
return errors.New("第二止盈价格不正确")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,7 +461,7 @@ func (req LineBatchAddPreOrderReq) CheckParams() error {
|
|||||||
if v.AddType == 1 && v.TakeProfitNumRatio.Cmp(decimal.NewFromInt(100)) < 0 &&
|
if v.AddType == 1 && v.TakeProfitNumRatio.Cmp(decimal.NewFromInt(100)) < 0 &&
|
||||||
v.TakeProfitNumRatio.Cmp(decimal.Zero) > 0 &&
|
v.TakeProfitNumRatio.Cmp(decimal.Zero) > 0 &&
|
||||||
(v.TpTpPriceRatio.IsZero() || v.TpTpPriceRatio.Cmp(decimal.NewFromInt(100)) > 0) {
|
(v.TpTpPriceRatio.IsZero() || v.TpTpPriceRatio.Cmp(decimal.NewFromInt(100)) > 0) {
|
||||||
return errors.New("止盈后止盈价格不正确")
|
return errors.New("第二止盈价格不正确")
|
||||||
}
|
}
|
||||||
|
|
||||||
// if v.TpSlPriceRatio.Cmp(decimal.Zero) <= 0 || v.TpSlPriceRatio.Cmp(decimal.NewFromInt(100)) > 0 {
|
// if v.TpSlPriceRatio.Cmp(decimal.Zero) <= 0 || v.TpSlPriceRatio.Cmp(decimal.NewFromInt(100)) > 0 {
|
||||||
|
|||||||
@ -1120,7 +1120,7 @@ func (e *LinePreOrder) AddBatchPreOrder(batchReq *dto.LineBatchAddPreOrderReq, p
|
|||||||
req.Price = batchReq.Price
|
req.Price = batchReq.Price
|
||||||
req.Profit = batchReq.Profit
|
req.Profit = batchReq.Profit
|
||||||
req.ProfitNumRatio = batchReq.ProfitNumRatio
|
req.ProfitNumRatio = batchReq.ProfitNumRatio
|
||||||
req.ProfitTpTpPriceRatio = batchReq.ProfitTpSlPriceRatio
|
req.ProfitTpTpPriceRatio = batchReq.ProfitTpTpPriceRatio
|
||||||
req.ProfitTpSlPriceRatio = batchReq.ProfitTpSlPriceRatio
|
req.ProfitTpSlPriceRatio = batchReq.ProfitTpSlPriceRatio
|
||||||
req.Ext = batchReq.Ext
|
req.Ext = batchReq.Ext
|
||||||
req.SymbolType = batchReq.SymbolType
|
req.SymbolType = batchReq.SymbolType
|
||||||
|
|||||||
@ -497,12 +497,10 @@ func handleFutMainOrderFilled(db *gorm.DB, preOrder *models.LinePreOrder, extOrd
|
|||||||
orderExt := models.LinePreOrderExt{}
|
orderExt := models.LinePreOrderExt{}
|
||||||
db.Model(&orderExt).Where("order_id =?", extOrderId).First(&orderExt)
|
db.Model(&orderExt).Where("order_id =?", extOrderId).First(&orderExt)
|
||||||
totalNum := getFuturesPositionAvailableQuantity(db, apiInfo, preOrder, tradeSet).Truncate(int32(tradeSet.AmountDigit))
|
totalNum := getFuturesPositionAvailableQuantity(db, apiInfo, preOrder, tradeSet).Truncate(int32(tradeSet.AmountDigit))
|
||||||
|
price := utility.StrToDecimal(preOrder.Price).Truncate(int32(tradeSet.PriceDigit))
|
||||||
|
|
||||||
// 更新订单数量并处理止盈、止损、减仓
|
// 更新订单数量并处理止盈、止损、减仓
|
||||||
for _, order := range orders {
|
for _, order := range orders {
|
||||||
price := utility.StrToDecimal(order.Price).Truncate(int32(tradeSet.PriceDigit))
|
|
||||||
order.Price = price.String()
|
|
||||||
|
|
||||||
// 更新止盈止损订单数量
|
// 更新止盈止损订单数量
|
||||||
num := updateOrderQuantity(db, order, preOrder, &orderExt, totalNum, first, tradeSet)
|
num := updateOrderQuantity(db, order, preOrder, &orderExt, totalNum, first, tradeSet)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user