| | |
| | | package project.project.web.admin; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.DecimalFormat; |
| | | import java.text.MessageFormat; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.persistence.Column; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | |
| | | String roleName = map.get("rolename").toString(); |
| | | map.put("roleNameDesc", Constants.ROLE_MAP.containsKey(roleName) ? Constants.ROLE_MAP.get(roleName) : roleName); |
| | | } |
| | | double currentPrice = Double.parseDouble(map.get("trade_avg_price").toString()); |
| | | |
| | | double leve = Double.parseDouble(map.get("lever_rate").toString()); |
| | | //得到强平价格 |
| | | if(null != map.get("direction")){ |
| | | double liquidationPrice; |
| | | if(map.get("direction").equals("sell")){ |
| | | liquidationPrice = currentPrice * (1 + (1 / leve)); |
| | | }else{ |
| | | liquidationPrice = currentPrice * (1 - 1 / leve); |
| | | } |
| | | DecimalFormat df = new DecimalFormat("#.#####"); |
| | | String formattedPrice = df.format(liquidationPrice); |
| | | map.put("qiangPing",formattedPrice); |
| | | } |
| | | } |
| | | |
| | | List<Item> items = this.itemService.cacheGetAll(); |
| | |
| | | String roleName = map.get("rolename").toString(); |
| | | map.put("roleNameDesc", Constants.ROLE_MAP.containsKey(roleName) ? Constants.ROLE_MAP.get(roleName) : roleName); |
| | | } |
| | | double currentPrice = Double.parseDouble(map.get("trade_avg_price").toString()); |
| | | |
| | | double leve = Double.parseDouble(map.get("lever_rate").toString()); |
| | | //得到强平价格 |
| | | if(null != map.get("direction")){ |
| | | double liquidationPrice; |
| | | if(map.get("direction").equals("sell")){ |
| | | liquidationPrice = currentPrice * (1 + (1 / leve)); |
| | | }else{ |
| | | liquidationPrice = currentPrice * (1 - 1 / leve); |
| | | } |
| | | DecimalFormat df = new DecimalFormat("#.#####"); |
| | | String formattedPrice = df.format(liquidationPrice); |
| | | map.put("qiangPing",formattedPrice); |
| | | } |
| | | } |
| | | |
| | | } catch (BusinessException e) { |