| | |
| | | return ServerResponse.createByErrorMsg("该新股不存在"); |
| | | } |
| | | if (userStockSubscribe.getStatus() == 4 || userStockSubscribe.getStatus() == 3 && stockSubscribe.getType() == 2) { |
| | | Stock stock = stockMapper.selectOne(new LambdaQueryWrapper<Stock>().eq(Stock::getStockSpell, userStockSubscribe.getNewCode())); |
| | | Stock stock = stockMapper.selectOne(new LambdaQueryWrapper<Stock>().eq(Stock::getStockCode, userStockSubscribe.getNewCode())); |
| | | if(null == stock){ |
| | | return ServerResponse.createByErrorMsg("该新股不存在"); |
| | | } |
| | |
| | | Result result = getResult(position); |
| | | if (result == null) continue; |
| | | |
| | | //利润为0不需要进行强制平仓 |
| | | if(result.signum == 0){ |
| | | continue; |
| | | } |
| | | boolean liquidation = false; |
| | | liquidation = isLiquidation(position, result.signum, result.profit, liquidation); |
| | | if(liquidation){ |
| | |
| | | //如果买涨 signum 为-1则表示亏损 |
| | | if(signum == -1){ |
| | | //止损 |
| | | if(null != position.getStopTargetPrice() && nowPrice.compareTo(position.getStopTargetPrice()) >= 0){ |
| | | if(null != position.getStopTargetPrice() && nowPrice.compareTo(position.getStopTargetPrice()) <= 0){ |
| | | //强制平仓 |
| | | return liquidation = true; |
| | | } |
| | |
| | | //买跌 signum |
| | | if(signum == 1){ |
| | | //止损 |
| | | if(null != position.getStopTargetPrice() && profit.compareTo(position.getStopTargetPrice()) >= 0){ |
| | | if(null != position.getStopTargetPrice() && nowPrice.compareTo(position.getStopTargetPrice()) >= 0){ |
| | | //强制平仓 |
| | | return liquidation = true; |
| | | } |
| | |
| | | } |
| | | }else{ |
| | | //止盈 |
| | | if(null != position.getProfitTargetPrice() && profit.compareTo(position.getProfitTargetPrice()) >= 0){ |
| | | if(null != position.getProfitTargetPrice() && nowPrice.compareTo(position.getProfitTargetPrice()) <= 0){ |
| | | //强制平仓 |
| | | return liquidation = true; |
| | | } |