| | |
| | | |
| | | // 占用保证金 -- 即持仓单中的保证金之和 |
| | | BigDecimal beUsedBondAmount = BigDecimal.ZERO; |
| | | BigDecimal moreBondAmount = BigDecimal.ZERO; |
| | | BigDecimal lessBondAmount = BigDecimal.ZERO; |
| | | // 总盈利 |
| | | BigDecimal totalProfitOrLess = BigDecimal.ZERO; |
| | | if (CollUtil.isNotEmpty(holdOrderEntities)) { |
| | |
| | | BigDecimal profitOrLess = BigDecimal.ZERO; |
| | | // 开多 |
| | | if (ContractHoldOrderEntity.OPENING_TYPE_MORE == holdOrderEntity.getOpeningType()) { |
| | | moreBondAmount = moreBondAmount.add(holdOrderEntity.getBondAmount()); |
| | | profitOrLess = newPrice.subtract(holdOrderEntity.getOpeningPrice()).multiply(new BigDecimal(holdOrderEntity.getSymbolCntSale())).multiply(lotNumber); |
| | | // 开空 |
| | | } else { |
| | | lessBondAmount = lessBondAmount.add(holdOrderEntity.getBondAmount()); |
| | | profitOrLess = holdOrderEntity.getOpeningPrice().subtract(newPrice).multiply(new BigDecimal(holdOrderEntity.getSymbolCntSale())).multiply(lotNumber); |
| | | } |
| | | |
| | |
| | | contractMoneyInfoVo.setUpOrDown(upOrDown); |
| | | contractMoneyInfoVo.setSymbolSku(cacheSettingUtils.getSymbolSku(symbol)); |
| | | contractMoneyInfoVo.setLeverRate(rateEntity.getLevelRateUp()); |
| | | contractMoneyInfoVo.setMoreBondAmount(moreBondAmount); |
| | | contractMoneyInfoVo.setLessBondAmount(lessBondAmount); |
| | | return Result.ok(contractMoneyInfoVo); |
| | | } |
| | | |
| | |
| | | holdOrderEntity.setOperateNo(holdOrderEntity.getOperateNo() + 1); |
| | | contractHoldOrderDao.updateById(holdOrderEntity); |
| | | |
| | | // 发送爆仓消息 |
| | | sendOrderBombMsg(holdOrderEntity.getId(), holdOrderEntity.getOpeningType(), newForcePrice, holdOrderEntity.getSymbol(), holdOrderEntity.getOperateNo(), holdOrderEntity.getMemberId()); |
| | | if (ContractEntrustOrderEntity.POSITION_TYPE_ADD == holdOrderEntity.getPositionType()) { |
| | | // 发送爆仓消息 |
| | | sendOrderBombMsg(holdOrderEntity.getId(), holdOrderEntity.getOpeningType(), newForcePrice, holdOrderEntity.getSymbol(), holdOrderEntity.getOperateNo(), holdOrderEntity.getMemberId()); |
| | | } |
| | | } |
| | | } |
| | | } |