| | |
| | | } |
| | | |
| | | GridElement longStopLossElem = GridElement.findByLongStopLossOrderId(orderId); |
| | | if (longStopLossElem != null && longPositionSize.compareTo(BigDecimal.ZERO) > 0 && StrUtil.isNotEmpty(tradeId) && !tradeId.equals("0")) { |
| | | // if (longStopLossElem != null && longPositionSize.compareTo(BigDecimal.ZERO) > 0 && StrUtil.isNotEmpty(tradeId) && !tradeId.equals("0")) { |
| | | if (longStopLossElem != null && StrUtil.isNotEmpty(tradeId) && !tradeId.equals("0")) { |
| | | handleLongStopLossTriggered(longStopLossElem); |
| | | return; |
| | | } |
| | | GridElement shortStopLossElem = GridElement.findByShortStopLossOrderId(orderId); |
| | | if (shortStopLossElem != null && shortPositionSize.compareTo(BigDecimal.ZERO) > 0 && StrUtil.isNotEmpty(tradeId) && !tradeId.equals("0")) { |
| | | // if (shortStopLossElem != null && shortPositionSize.compareTo(BigDecimal.ZERO) > 0 && StrUtil.isNotEmpty(tradeId) && !tradeId.equals("0")) { |
| | | if (shortStopLossElem != null && StrUtil.isNotEmpty(tradeId) && !tradeId.equals("0")) { |
| | | handleShortStopLossTriggered(shortStopLossElem); |
| | | return; |
| | | } |
| | |
| | | |
| | | GridElement matchedUpGridElement = GridElement.findByPrice(matched); |
| | | if (matchedUpGridElement != null){ |
| | | if (!matchedUpGridElement.isHasLongOrder()){ |
| | | Integer upId = matchedUpGridElement.getUpId(); |
| | | GridElement newEntryGrid = GridElement.findById(upId); |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | GridElement matchedUpGridElement = GridElement.findByPrice(matched); |
| | | if (matchedUpGridElement != null){ |
| | | if(!matchedUpGridElement.isHasShortOrder()){ |
| | | Integer downId = matchedUpGridElement.getDownId(); |
| | | GridElement newEntryGrid = GridElement.findById(downId); |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void handleLongStopLossTriggered(GridElement gridElement) { |
| | | gridElement.setLongStopLossOrderId(null); |