From dd315d5732e14fcf3df71e0cf213cc442bd8607b Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Tue, 25 Feb 2025 14:30:07 +0800
Subject: [PATCH] 时间

---
 src/main/java/project/contract/internal/ContractOrderServiceImpl.java |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/main/java/project/contract/internal/ContractOrderServiceImpl.java b/src/main/java/project/contract/internal/ContractOrderServiceImpl.java
index a7330c2..86559a3 100644
--- a/src/main/java/project/contract/internal/ContractOrderServiceImpl.java
+++ b/src/main/java/project/contract/internal/ContractOrderServiceImpl.java
@@ -501,7 +501,21 @@
 		} else {
 			map.put("profit", df.format(Arith.sub(Arith.add(order.getAmount_close(), order.getDeposit()), order.getDeposit_open())));
 		}
+		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 dfs = new DecimalFormat("#.#####");
+			String formattedPrice = dfs.format(liquidationPrice);
+			map.put("qiangPing",formattedPrice);
+		}
 		map.put("volume", order.getVolume());
 		map.put("volume_open", order.getVolume_open());
 

--
Gitblit v1.9.3