1
This commit is contained in:
@ -404,6 +404,7 @@ func handleFutMainOrderFilled(db *gorm.DB, preOrder *models.LinePreOrder) {
|
||||
logger.Errorf("修改止盈止损数量失败 订单号:%s err:%v", order.OrderSn, err)
|
||||
}
|
||||
|
||||
logger.Errorf("止盈止损 下单数量:%v", num)
|
||||
switch order.OrderType {
|
||||
case 1: // 止盈
|
||||
processFutTakeProfitOrder(db, futApi, order, num)
|
||||
@ -446,13 +447,14 @@ func processFutReduceOrder(order DbModels.LinePreOrder, price, num decimal.Decim
|
||||
// 处理止盈订单
|
||||
func processFutTakeProfitOrder(db *gorm.DB, futApi FutRestApi, order models.LinePreOrder, num decimal.Decimal) {
|
||||
price, _ := decimal.NewFromString(order.Price)
|
||||
tradeSet, _ := GetTradeSet(order.Symbol, 1)
|
||||
|
||||
params := FutOrderPlace{
|
||||
ApiId: order.ApiId,
|
||||
Symbol: order.Symbol,
|
||||
Side: order.Site,
|
||||
Price: price,
|
||||
Quantity: num,
|
||||
Price: price.Truncate(int32(tradeSet.PriceDigit)),
|
||||
Quantity: num.Truncate(int32(tradeSet.AmountDigit)),
|
||||
OrderType: "TAKE_PROFIT",
|
||||
Profit: price,
|
||||
NewClientOrderId: order.OrderSn,
|
||||
@ -477,12 +479,14 @@ func processFutTakeProfitOrder(db *gorm.DB, futApi FutRestApi, order models.Line
|
||||
// 处理止损订单
|
||||
// order 止损单
|
||||
func processFutStopLossOrder(db *gorm.DB, order models.LinePreOrder, price, num decimal.Decimal) error {
|
||||
tradeSet, _ := GetTradeSet(order.Symbol, 1)
|
||||
|
||||
params := FutOrderPlace{
|
||||
ApiId: order.ApiId,
|
||||
Symbol: order.Symbol,
|
||||
Side: order.Site,
|
||||
Price: price,
|
||||
Quantity: num,
|
||||
Price: price.Truncate(int32(tradeSet.PriceDigit)),
|
||||
Quantity: num.Truncate(int32(tradeSet.AmountDigit)),
|
||||
OrderType: "STOP",
|
||||
StopPrice: price,
|
||||
NewClientOrderId: order.OrderSn,
|
||||
|
||||
Reference in New Issue
Block a user