| | |
| | | profit = Arith.add(profit,totleMoney); |
| | | |
| | | |
| | | if (map.get("direction") != null) { |
| | | if (map.get("direction") != null && map.get("state").equals("submitted")) { |
| | | String direction = map.get("direction").toString(); |
| | | double liquidationPrice; |
| | | double deposit = profit; |
| | |
| | | liquidationPrice = tradeAvgPrice - priceDrop; |
| | | } |
| | | } |
| | | // 检查 liquidationPrice 是否为有效数字 |
| | | if (Double.isInfinite(liquidationPrice) || Double.isNaN(liquidationPrice)) { |
| | | liquidationPrice = 0; // 如果是无效结果,回退为 0 |
| | | } |
| | | DecimalFormat dfs = new DecimalFormat("#.#####"); |
| | | String formattedPrice = dfs.format(liquidationPrice); |
| | | // 检查是否为负数 |