| | |
| | | private void checkUserStatus(String partyId) { |
| | | User user = userService.getById(partyId); |
| | | if (!user.isEnabled()) { |
| | | throw new YamiShopBindException("用户已锁定"); |
| | | throw new YamiShopBindException("User is locked"); |
| | | } |
| | | } |
| | | |
| | |
| | | try { |
| | | User user = userService.getById(partyId); |
| | | if (!user.isEnabled()) { |
| | | throw new YamiShopBindException("用户已锁定"); |
| | | throw new YamiShopBindException("User is locked"); |
| | | } |
| | | |
| | | Syspara syspara = sysparaService.find("stop_user_internet"); |
| | |
| | | map.put("price", order.getPrice()); |
| | | map.put("stop_price_profit", order.getStopPriceProfit()); |
| | | if( order.getStopPriceLoss() !=null) { |
| | | map.put("stop_price_loss", order.getStopPriceLoss().setScale(4, RoundingMode.HALF_UP)); |
| | | map.put("stop_price_loss", order.getStopPriceLoss().setScale(4, RoundingMode.DOWN)); |
| | | }else{ |
| | | map.put("stop_price_loss", null); |
| | | |
| | | } |
| | | map.put("price_type", order.getOrderPriceType()); |
| | | map.put("state", order.getState()); |
| | | map.put("amount", order.getVolume().multiply(order.getUnitAmount()).setScale(4, RoundingMode.HALF_UP)); |
| | | map.put("amount", order.getVolume().multiply(order.getUnitAmount()).setScale(4, RoundingMode.DOWN)); |
| | | map.put("amount_open", order.getVolumeOpen().multiply(order.getUnitAmount())); |
| | | map.put("fee", order.getFee()); |
| | | map.put("deposit", order.getDeposit()); |
| | |
| | | Realtime realtime = realtimeMap.get(data.getSymbol()); |
| | | BigDecimal mark_price = realtime.getClose(); |
| | | if(data.getDirection().equalsIgnoreCase("buy")){ |
| | | expectedProfitAndLoss += data.getVolume().multiply(data.getLeverRate()).multiply(data.getUnitAmount()).multiply(mark_price.subtract(data.getPrice()).divide(data.getPrice(), 4, RoundingMode.HALF_UP)).doubleValue(); |
| | | expectedProfitAndLoss += data.getVolume().multiply(data.getLeverRate()).multiply(data.getUnitAmount()).multiply(mark_price.subtract(data.getPrice()).divide(data.getPrice(), 4, RoundingMode.DOWN)).doubleValue(); |
| | | }else{ |
| | | expectedProfitAndLoss -= data.getVolume().multiply(data.getLeverRate()).multiply(data.getUnitAmount()).multiply(mark_price.subtract(data.getPrice()).divide(data.getPrice(), 4, RoundingMode.HALF_UP)).doubleValue(); |
| | | expectedProfitAndLoss -= data.getVolume().multiply(data.getLeverRate()).multiply(data.getUnitAmount()).multiply(mark_price.subtract(data.getPrice()).divide(data.getPrice(), 4, RoundingMode.DOWN)).doubleValue(); |
| | | } |
| | | //手续费 |
| | | double fee = Double.parseDouble(data.getFee().toString()); |