| | |
| | | } |
| | | shortGridElement.setExtendStopLossInProgress(true); |
| | | |
| | | accumulatedShortLossCount = 0; |
| | | lastShortStopLossGridId = Integer.MAX_VALUE; |
| | | // [Gate-需求2] 加仓后先撤空仓所有止盈+止损,再查交易所持仓后重挂 |
| | | cancelAllShortTakeProfitsAndStopLosses(); |
| | |
| | | log.info("[Gate] 空单成交 gridId:{}, 当前持仓:{}张", filledQty, posSize); |
| | | |
| | | |
| | | |
| | | accumulatedShortLossCount++; |
| | | checkShortStopLongProfit(accumulatedShortLossCount, shortGridElement.getId() + 2); |
| | | |
| | | } |
| | |
| | | // placeExcessTakeProfit(posSize, true); |
| | | log.info("[Gate] 多单成交 gridId:{}, 当前持仓:{}张", filledQty, posSize); |
| | | |
| | | |
| | | accumulatedLongLossCount++; |
| | | checkLongStopShortProfit(accumulatedLongLossCount, longGridElement.getId() -2); |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | lastLongStopLossGridId = gridId; |
| | | accumulatedLongLossCount++; |
| | | log.info("[Gate] 多仓止损触发 gridId:{}, 止损次数:{}{}, 开始追单", |
| | | gridId, accumulatedLongLossCount, sameGrid ? "(同网格)" : ""); |
| | | int newEntryGridId = gridId + 1; |
| | |
| | | * </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; |
| | | } |
| | |
| | | return; |
| | | } |
| | | lastShortStopLossGridId = gridId; |
| | | accumulatedShortLossCount++; |
| | | log.info("[Gate] 空仓止损触发 gridId:{}, 止损次数:{}{}, 开始追单", |
| | | gridId, accumulatedShortLossCount, sameGrid ? "(同网格)" : ""); |
| | | int newEntryGridId = gridId - 1; |