| | |
| | | return Result.fail("可平张数不足"); |
| | | } |
| | | |
| | | log.info("--->{},{}", holdOrderEntity.getSymbolCntSale(), wholeCloseOrderDto.getCount()); |
| | | // 判断当前持仓张数是否等于平仓张数,若等于则直接更新该订单为不可平状态,否则更新可平张数 |
| | | if (wholeCloseOrderDto.getCount() == holdOrderEntity.getSymbolCntSale()) { |
| | | contractHoldOrderDao.updateHoldOrderIsCanClosingById(ContractHoldOrderEntity.ORDER_CAN_CLOSING_N, wholeCloseOrderDto.getId()); |
| | |
| | | // 发送平仓消息 |
| | | List<Long> ids = new ArrayList<>(); |
| | | ids.add(wholeCloseOrderDto.getId()); |
| | | producer.sendCloseTrade(JSONObject.toJSONString(ids)); |
| | | // producer.sendCloseTrade(JSONObject.toJSONString(ids)); |
| | | |
| | | // 平仓成功 |
| | | return Result.ok(MessageSourceUtils.getString("order_service_0044")); |
| | |
| | | // 爆仓价 |
| | | BigDecimal forceSetPrice = order.getForceClosingPrice(); |
| | | if (forceSetPrice != null) { |
| | | if (forceSetPrice.compareTo(BigDecimal.ZERO) >= 0) { |
| | | OrderModel model = new OrderModel(order.getId(), RabbitPriceTypeEnum.CLOSE_MORE_BOMB.getValue(), forceSetPrice.toPlainString(), |
| | | order.getSymbol(), order.getOperateNo()); |
| | | producer.sendPriceOperate(JSONObject.toJSONString(model)); |
| | | } |
| | | } |
| | | // 止损 |
| | | BigDecimal stopLossPrice = order.getStopLossPrice(); |
| | | if (stopLossPrice != null && stopLossPrice.compareTo(BigDecimal.ZERO) > 0) { |
| | |
| | | holdOrderDao.updateById(updateHoldOrder);
|
| | |
|
| | | if (forceSetPrice.compareTo(BigDecimal.ZERO) >= 0) {
|
| | | sendOrderBombMsg(updateHoldOrder.getId(), updateHoldOrder.getOpeningType(), forceSetPrice, updateHoldOrder.getSymbol(), updateHoldOrder.getOperateNo());
|
| | | // sendOrderBombMsg(updateHoldOrder.getId(), updateHoldOrder.getOpeningType(), forceSetPrice, updateHoldOrder.getSymbol(), updateHoldOrder.getOperateNo());
|
| | | }
|
| | | }
|
| | | } else {
|