| | |
| | | } else { |
| | | //ai交易 计算收益率 收益/本金*100 |
| | | BigDecimal profitAndLose = userPositionVO.getProfitAndLose() |
| | | .divide(userPositionVO.getOrderTotalPrice()) |
| | | .divide(userPositionVO.getOrderTotalPrice(), RoundingMode.HALF_UP) |
| | | .multiply(new BigDecimal(100)) |
| | | .setScale(2, BigDecimal.ROUND_DOWN); |
| | | .setScale(2, RoundingMode.DOWN); |
| | | userPositionVO.setNow_price(String.valueOf(userPositionVO.getSellOrderPrice().setScale(2, RoundingMode.HALF_UP))); |
| | | userPositionVO.setProfitAndLoseParent(profitAndLose + "%"); |
| | | userPositionVO.setSellOrderTotalPrice(userPositionVO.getSellOrderPrice().multiply(BigDecimal.valueOf(userPositionVO.getOrderNum()))); |
| | | } |
| | | resultUserPositions.add(userPositionVO); |
| | | } |
| | |
| | | pageInfo.setList(resultUserPositions); |
| | | return ServerResponse.createBySuccess(pageInfo); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("IUserPositionService findMyPositionByParam {}", e.getMessage()); |
| | | } |
| | | return ServerResponse.createByError(); |