| | |
| | | import com.nq.vo.position.UserPositionVO; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | |
| | | /** |
| | | * 仓位计算工具类 |
| | |
| | | * */ |
| | | public static UserPositionVO assembleUserPositionVO2(UserPositionVO userPositionVO,BigDecimal nowPrice) { |
| | | PositionProfitVO positionProfitVO = getPositionProfitVO2(userPositionVO, nowPrice); |
| | | BigDecimal ss = positionProfitVO.getProfitAndLose().divide(userPositionVO.getOrderTotalPrice(),BigDecimal.ROUND_CEILING) |
| | | BigDecimal ss = positionProfitVO.getProfitAndLose().divide(userPositionVO.getOrderTotalPrice(), RoundingMode.CEILING) |
| | | .multiply(new BigDecimal(100)); |
| | | ss = ss.setScale(2, BigDecimal.ROUND_DOWN); |
| | | ss = ss.setScale(2, RoundingMode.DOWN); |
| | | userPositionVO.setProfitAndLoseParent(ss+"%"); |
| | | userPositionVO.setProfitAndLoseParent2(ss); |
| | | userPositionVO.setProfitAndLose(positionProfitVO.getProfitAndLose()); |