zj
2025-05-28 bcd36411feb0351347289476eb7ee9e5dd1c3b9d
src/main/java/project/project/web/api/ContractOrderController.java
@@ -1,4 +1,4 @@
package project.project.web.api;
package project.web.api;
import java.io.IOException;
import java.text.DecimalFormat;
@@ -216,25 +216,29 @@
            if (map.get("direction") != null) {
               String direction = map.get("direction").toString();
               double liquidationPrice;
               double deposit = depositOpen + profit;
               double deposit =  profit;
               if(leverRate == 1){
                  liquidationPrice = 0;
               }else {
                  if ("sell".equals(direction)) {
                     liquidationPrice = tradeAvgPrice + (deposit / div);
                     double lossPercentage = deposit / Double.parseDouble(map.get("amount").toString());
                     double priceIncrease = lossPercentage * tradeAvgPrice;
                     liquidationPrice = tradeAvgPrice + priceIncrease;
                  } else {
                     liquidationPrice = (mul * tradeAvgPrice) / (deposit + mul);
                     double lossPercentage = deposit / Double.parseDouble(map.get("amount").toString());
                     double priceDrop = lossPercentage * tradeAvgPrice;
                     liquidationPrice = tradeAvgPrice - priceDrop;
                  }
               }
               DecimalFormat dfs = new DecimalFormat("#.#####");
               String formattedPrice = dfs.format(liquidationPrice);
               // 检查是否为负数
               if (Double.parseDouble(formattedPrice) < 0) {
                  formattedPrice = "0";
               }
               map.put("qiangPing", formattedPrice);
            }
            // 标记价格
            Realtime realtime = realtimeMap.get(map.get("symbol"));
            if (null == realtime) {