| | |
| | | if (StrUtil.isNotEmpty(tradeId) && !tradeId.equals("0") ){ |
| | | int filledQty = Integer.parseInt(shortGridElement.getShortTraderParam().getQuantity()); |
| | | shortEntryTraderIdParam(shortGridElement, orderId, false); |
| | | accumulatedShortLossCount = 0; // 空单成交,重置止损追单计数 |
| | | // [Gate-需求2] 加仓后先撤空仓所有止盈+止损,再查交易所持仓后重挂 |
| | | cancelAllShortTakeProfitsAndStopLosses(); |
| | | // REST 查询可能因交易所延迟返回旧值,与 WS 本地缓存取最大值兜底 |
| | |
| | | |
| | | int filledQty = Integer.parseInt(longGridElement.getLongTraderParam().getQuantity()); |
| | | longEntryTraderIdParam(longGridElement, orderId, false); |
| | | accumulatedLongLossCount = 0; // 多单成交,重置止损追单计数 |
| | | // [Gate-需求2] 加仓后先撤多仓所有止盈+止损,再查交易所持仓后重挂 |
| | | cancelAllLongTakeProfitsAndStopLosses(); |
| | | // REST 查询可能因交易所延迟返回旧值,与 WS 本地缓存取最大值兜底 |
| | |
| | | BigDecimal triggerPrice = newEntryGrid.getGridPrice(); |
| | | int posSize = Math.min(queryPositionSize(Position.ModeEnum.DUAL_LONG), longPositionSize.intValue()); |
| | | int maxPos = config.getMaxPositionSize(); |
| | | int targetAmount; |
| | | if (config.getStopLossCount() > 0 && accumulatedLongLossCount <= config.getStopLossCount()) { |
| | | targetAmount = Integer.parseInt(config.getQuantity()); |
| | | } else { |
| | | targetAmount = Integer.parseInt(config.getQuantity()) * 2; |
| | | } |
| | | int baseQty = Integer.parseInt(config.getBaseQuantity()); |
| | | int gridQty = Integer.parseInt(config.getQuantity()); |
| | | int targetAmount = baseQty + (accumulatedLongLossCount - 1) * gridQty; |
| | | int addSize; |
| | | if (maxPos > 0) { |
| | | int remainingRoom = maxPos - posSize; |
| | |
| | | BigDecimal triggerPrice = newEntryGrid.getGridPrice(); |
| | | int posSize = Math.min(queryPositionSize(Position.ModeEnum.DUAL_SHORT), shortPositionSize.intValue()); |
| | | int maxPos = config.getMaxPositionSize(); |
| | | int targetAmount; |
| | | if (config.getStopLossCount() > 0 && accumulatedShortLossCount <= config.getStopLossCount()) { |
| | | targetAmount = Integer.parseInt(config.getQuantity()); |
| | | } else { |
| | | targetAmount = Integer.parseInt(config.getQuantity()) * 2; |
| | | } |
| | | int baseQty = Integer.parseInt(config.getBaseQuantity()); |
| | | int gridQty = Integer.parseInt(config.getQuantity()); |
| | | int targetAmount = baseQty + (accumulatedShortLossCount - 1) * gridQty; |
| | | int addSize; |
| | | if (maxPos > 0) { |
| | | int remainingRoom = maxPos - posSize; |