From a0295049dfce83691dccab5d33992a368e78bc48 Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Sun, 25 May 2025 21:40:17 +0800
Subject: [PATCH] 1

---
 src/main/java/project/project/web/api/ContractOrderController.java |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/main/java/project/project/web/api/ContractOrderController.java b/src/main/java/project/project/web/api/ContractOrderController.java
index 029f37b..ab78e0b 100644
--- a/src/main/java/project/project/web/api/ContractOrderController.java
+++ b/src/main/java/project/project/web/api/ContractOrderController.java
@@ -216,25 +216,25 @@
 				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);
 					map.put("qiangPing", formattedPrice);
 				}
-
-
-
-
 				// 标记价格
 				Realtime realtime = realtimeMap.get(map.get("symbol"));
 				if (null == realtime) {

--
Gitblit v1.9.3