| | |
| | | } |
| | | shortGridElement.setExtendStopLossInProgress(true); |
| | | |
| | | accumulatedShortLossCount = 0; |
| | | lastShortStopLossGridId = Integer.MAX_VALUE; |
| | | // [Gate-需求2] 加仓后先撤空仓所有止盈+止损,再查交易所持仓后重挂 |
| | | cancelAllShortTakeProfitsAndStopLosses(); |
| | |
| | | * </ul> |
| | | */ |
| | | private static final Map<Integer, int[]> STOP_LOSS_RULES = new LinkedHashMap<>(); |
| | | private static final int DEFAULT_STOP_LOSS_PERCENT = 5; |
| | | |
| | | static { |
| | | // times {满仓%, 阈值%} |
| | |
| | | int selfPos = Math.max(queryPositionSize(Position.ModeEnum.DUAL_LONG), longPositionSize.intValue()); |
| | | int excess = selfPos - thresholdPosNum; |
| | | if (excess > 0) { |
| | | int perOrderQty = maxPos * 5 / 100; |
| | | int perOrderQty = maxPos * DEFAULT_STOP_LOSS_PERCENT / 100; |
| | | if (perOrderQty <= 0) { |
| | | perOrderQty = 1; |
| | | } |
| | |
| | | int selfPos = Math.max(queryPositionSize(Position.ModeEnum.DUAL_SHORT), shortPositionSize.intValue()); |
| | | int excess = selfPos - thresholdPosNum; |
| | | if (excess > 0) { |
| | | int perOrderQty = maxPos * 5 / 100; |
| | | int perOrderQty = maxPos * DEFAULT_STOP_LOSS_PERCENT / 100; |
| | | if (perOrderQty <= 0) { |
| | | perOrderQty = 1; |
| | | } |