| | |
| | | return; |
| | | } |
| | | |
| | | // [Gate-需求1] 多仓止盈触发:清空止盈状态 + 取消最近多仓止损 |
| | | GridElement longTpElem = GridElement.findByLongTakeProfitOrderId(orderId); |
| | | if (longTpElem != null && StrUtil.isNotEmpty(tradeId) && !tradeId.equals("0")) { |
| | | longTakeProfitTraderIdParam(longTpElem, null, false); |
| | | // log.info("[Gate] 多仓止盈触发 gridId:{}, orderId:{}", longTpElem.getId(), orderId); |
| | | // cancelNearestLongStopLoss(); |
| | | return; |
| | | } |
| | | // [Gate-需求1] 空仓止盈触发:清空止盈状态 + 取消最近空仓止损 |
| | | GridElement shortTpElem = GridElement.findByShortTakeProfitOrderId(orderId); |
| | | if (shortTpElem != null && StrUtil.isNotEmpty(tradeId) && !tradeId.equals("0")) { |
| | | shortTakeProfitTraderIdParam(shortTpElem, null, false); |
| | | // log.info("[Gate] 空仓止盈触发 gridId:{}, orderId:{}", shortTpElem.getId(), orderId); |
| | | // cancelNearestShortStopLoss(); |
| | | // checkLastTakeProfitAndRestart(); |
| | | return; |
| | | } |
| | | // // [Gate-需求1] 多仓止盈触发:清空止盈状态 + 取消最近多仓止损 |
| | | // GridElement longTpElem = GridElement.findByLongTakeProfitOrderId(orderId); |
| | | // if (longTpElem != null && StrUtil.isNotEmpty(tradeId) && !tradeId.equals("0")) { |
| | | // longTakeProfitTraderIdParam(longTpElem, null, false); |
| | | //// log.info("[Gate] 多仓止盈触发 gridId:{}, orderId:{}", longTpElem.getId(), orderId); |
| | | //// cancelNearestLongStopLoss(); |
| | | // return; |
| | | // } |
| | | // // [Gate-需求1] 空仓止盈触发:清空止盈状态 + 取消最近空仓止损 |
| | | // GridElement shortTpElem = GridElement.findByShortTakeProfitOrderId(orderId); |
| | | // if (shortTpElem != null && StrUtil.isNotEmpty(tradeId) && !tradeId.equals("0")) { |
| | | // shortTakeProfitTraderIdParam(shortTpElem, null, false); |
| | | //// log.info("[Gate] 空仓止盈触发 gridId:{}, orderId:{}", shortTpElem.getId(), orderId); |
| | | //// cancelNearestShortStopLoss(); |
| | | //// checkLastTakeProfitAndRestart(); |
| | | // return; |
| | | // } |
| | | |
| | | GridElement longStopLossElem = GridElement.findByLongStopLossOrderId(orderId); |
| | | // if (longStopLossElem != null && longPositionSize.compareTo(BigDecimal.ZERO) > 0 && StrUtil.isNotEmpty(tradeId) && !tradeId.equals("0")) { |
| | |
| | | if (newEntryGrid != null) { |
| | | |
| | | // String quantity = String.valueOf((accumulatedLongLossCount + 1) * Integer.parseInt(config.getQuantity())); |
| | | String quantity = String.valueOf(Math.max(queryPositionSize(Position.ModeEnum.DUAL_SHORT), shortPositionSize.intValue()) + 1); |
| | | String quantity = String.valueOf(Math.max(queryPositionSize(Position.ModeEnum.DUAL_SHORT), shortPositionSize.intValue()) + Integer.parseInt(config.getQuantity())); |
| | | // 向上遍历取消所有遗留多单(跳过基础入场网格0) |
| | | GridElement cancelCursor = GridElement.findById(newEntryGrid.getUpId()); |
| | | while (cancelCursor != null) { |
| | |
| | | if (newEntryGrid != null) { |
| | | |
| | | // String quantity = String.valueOf((accumulatedShortLossCount + 1) * Integer.parseInt(config.getQuantity())); |
| | | String quantity = String.valueOf(Math.max(queryPositionSize(Position.ModeEnum.DUAL_LONG), longPositionSize.intValue()) + 1); |
| | | String quantity = String.valueOf(Math.max(queryPositionSize(Position.ModeEnum.DUAL_LONG), longPositionSize.intValue()) + Integer.parseInt(config.getQuantity())); |
| | | // 向下遍历取消所有遗留空单(跳过基础入场网格0) |
| | | GridElement cancelCursor = GridElement.findById(newEntryGrid.getDownId()); |
| | | while (cancelCursor != null) { |