From 6eef7f43f9ad3d82727fba36f543f268cfb646d2 Mon Sep 17 00:00:00 2001
From: zyy <zyy@email.com>
Date: Tue, 09 Dec 2025 18:39:30 +0800
Subject: [PATCH] 大宗
---
trading-order-admin/src/main/java/com/yami/trading/api/controller/exchange/ApiExchangeApplyOrderController.java | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/trading-order-admin/src/main/java/com/yami/trading/api/controller/exchange/ApiExchangeApplyOrderController.java b/trading-order-admin/src/main/java/com/yami/trading/api/controller/exchange/ApiExchangeApplyOrderController.java
index ee906ee..e1747eb 100644
--- a/trading-order-admin/src/main/java/com/yami/trading/api/controller/exchange/ApiExchangeApplyOrderController.java
+++ b/trading-order-admin/src/main/java/com/yami/trading/api/controller/exchange/ApiExchangeApplyOrderController.java
@@ -37,6 +37,7 @@
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
+import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.ArrayList;
@@ -385,6 +386,9 @@
map.put("create_time", order.getCreateTime());
map.put("create_time_ts", order.getCreateTimeTs());
map.put("volume", order.getVolume());
+ map.put("symbolValue", order.getSymbolValue());
+ double totalMoney = BigDecimal.valueOf(order.getSymbolValue() * order.getClosePrice()).setScale(4, RoundingMode.HALF_UP).doubleValue();
+ map.put("totalMoney", totalMoney);
map.put("offset", order.getOffset());
map.put("price", order.getPrice());
map.put("order_price_type", order.getOrderPriceType());
@@ -393,6 +397,24 @@
map.put("close_price", order.getClosePrice());
map.put("close_time", order.getCloseTime());
map.put("close_time_ts", order.getCloseTime() == null ? "" : order.getCloseTime().getTime());
+
+ if (ExchangeApplyOrder.OFFSET_CLOSE.equals(order.getOffset())) {
+ List<ExchangeSymbolDto> exchangeSymbolDtos = exchangeApplyOrderService.querySpotTradPosition(order.getPartyId(), order.getSymbol());
+ if (exchangeSymbolDtos != null && !exchangeSymbolDtos.isEmpty()) {
+ ExchangeSymbolDto exchangeSymbolDto = exchangeSymbolDtos.get(0);
+ double costPrice = exchangeSymbolDto.getPrice();
+ //单个收益
+ double profitLoss = order.getClosePrice() - costPrice;
+ double profitLossPercentage = (profitLoss / costPrice ) * 100;
+ profitLossPercentage = new BigDecimal(profitLossPercentage).setScale(2, RoundingMode.HALF_UP).doubleValue();
+ //总收益
+ double profitLossSum = new BigDecimal(profitLoss * order.getVolume()).setScale(4, RoundingMode.HALF_UP).doubleValue();
+
+ map.put("costPrice", costPrice);
+ map.put("profitLoss", profitLossSum);
+ map.put("profitLossPercentage", profitLossPercentage);
+ }
+ }
return map;
}
--
Gitblit v1.9.3