|
|
@ -134,25 +134,25 @@ namespace Binance.TradeRobot.Business |
|
|
|
updateUserList = new List<IUpdate<User>>(); |
|
|
|
insertUserAccountProfitLossRecordList = new List<UserAccountProfitLossRecord>(); |
|
|
|
|
|
|
|
if (spotOrderPublishInfo.OrderType == Enums.OrderType.MARKET) |
|
|
|
{ |
|
|
|
//市价卖单完全成交,取消尚未触发的限价止损单
|
|
|
|
try |
|
|
|
{ |
|
|
|
CancelStopLossOrder(robot, apiClient); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
logList.Add(new ExecutionLog() |
|
|
|
{ |
|
|
|
Id = idGenerator.NewLong(), |
|
|
|
SourceSingal = Enums.SingalType.订单推送, |
|
|
|
RobotId = robot.Id, |
|
|
|
CreateTime = DateTime.Now, |
|
|
|
Content = $"取消止损单失败,{ex.Message}" |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
//if (spotOrderPublishInfo.OrderType == Enums.OrderType.MARKET)
|
|
|
|
//{
|
|
|
|
//市价卖单完全成交,取消尚未触发的限价止损单
|
|
|
|
//try
|
|
|
|
//{
|
|
|
|
// CancelStopLossOrder(robot, apiClient);
|
|
|
|
//}
|
|
|
|
//catch (Exception ex)
|
|
|
|
//{
|
|
|
|
// logList.Add(new ExecutionLog()
|
|
|
|
// {
|
|
|
|
// Id = idGenerator.NewLong(),
|
|
|
|
// SourceSingal = Enums.SingalType.订单推送,
|
|
|
|
// RobotId = robot.Id,
|
|
|
|
// CreateTime = DateTime.Now,
|
|
|
|
// Content = $"取消止损单失败,{ex.Message}"
|
|
|
|
// });
|
|
|
|
//}
|
|
|
|
//}
|
|
|
|
|
|
|
|
var interest = 0M; //借币利息
|
|
|
|
var loanAmount = robot.RobotAccount.LoanAmount; //借币金额
|
|
|
@ -297,17 +297,5 @@ namespace Binance.TradeRobot.Business |
|
|
|
Content = $"{(isFirstStopLoss ? 1 : 2)}级止损挂单成功,订单号:{stopOrderId},挂单数量:{stopQuantity}" |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private void CancelStopLossOrder(D21PolicyRobotResponse d21Robot, BaseAPIClient baseAPIClient) |
|
|
|
{ |
|
|
|
var stopLossOrderIdList = fsql.Select<SpotOrder>().Where(o => o.OrderType == Enums.OrderType.STOP_LOSS_LIMIT && |
|
|
|
o.State == Enums.SpotOrderState.Created && |
|
|
|
o.RobotId == d21Robot.Id).ToList(o => o.Id); |
|
|
|
if (stopLossOrderIdList == null || stopLossOrderIdList.Count() == 0) |
|
|
|
return; |
|
|
|
|
|
|
|
foreach (var stopLossOrderId in stopLossOrderIdList) |
|
|
|
baseAPIClient.CancelIsolateMarginOrder(d21Robot.Symbol, stopLossOrderId); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|