From 31e6203a5bb778ad9d1c599171606c89c8edd3a3 Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Thu, 21 May 2026 15:59:47 +0800
Subject: [PATCH] 1
---
trading-order-admin/src/main/java/com/yami/trading/admin/task/RealtimeWebsocketServer.java | 40 +++++++++++++++++++++++-----------------
1 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/trading-order-admin/src/main/java/com/yami/trading/admin/task/RealtimeWebsocketServer.java b/trading-order-admin/src/main/java/com/yami/trading/admin/task/RealtimeWebsocketServer.java
index 52c4782..87728fc 100644
--- a/trading-order-admin/src/main/java/com/yami/trading/admin/task/RealtimeWebsocketServer.java
+++ b/trading-order-admin/src/main/java/com/yami/trading/admin/task/RealtimeWebsocketServer.java
@@ -96,7 +96,8 @@
if (itemService.isSuspended(symbol)) {
return;
}
- Double currentValue = AdjustmentValueCache.getCurrentValue().get(symbol).doubleValue();
+ BigDecimal adjustment = AdjustmentValueCache.getCurrentValue().get(symbol);
+ double currentValue = adjustment != null ? adjustment.doubleValue() : 0D;
double close = event.getTicker().getClose().doubleValue();
double vol = event.getTicker().getVol().doubleValue();
double amount = event.getTicker().getAmount().doubleValue();
@@ -111,21 +112,23 @@
realtime.setVolume(new BigDecimal(vol));
realtime.setAmount(new BigDecimal(amount));
- if (currentValue != null && currentValue != 0) {
- realtime.setClose(new BigDecimal(Arith.add(close, currentValue.doubleValue())));
- realtime.setVolume(new BigDecimal(Arith.add(vol, Arith.mul(Arith.div(currentValue, close), vol))));
- realtime.setAmount(new BigDecimal(Arith.add(amount, Arith.mul(Arith.div(currentValue, close), amount))));
+ if (currentValue != 0) {
+ realtime.setClose(new BigDecimal(Arith.add(close, currentValue)));
+ //realtime.setVolume(new BigDecimal(Arith.add(vol, Arith.mul(Arith.div(currentValue, close), vol))));
+ //realtime.setAmount(new BigDecimal(Arith.add(amount, Arith.mul(Arith.div(currentValue, close), amount))));
+
+ Double high = DataCache.getRealtimeHigh().get(symbol);
+ Double low = DataCache.getRealtimeLow().get(symbol);
+
+ if (high != null) {
+ realtime.setHigh(BigDecimal.valueOf(high));
+ }
+ if (low != null) {
+ realtime.setLow(BigDecimal.valueOf(low));
+ }
}
- Double high = DataCache.getRealtimeHigh().get(symbol);
- Double low = DataCache.getRealtimeLow().get(symbol);
- if (high == null || realtime.getClose().doubleValue() > high) {
- DataCache.getRealtimeHigh().put(symbol, close);
- }
- if ((low == null || realtime.getClose().doubleValue() < low) && realtime.getClose().doubleValue() > 0) {
- DataCache.getRealtimeLow().put(symbol, close);
- }
Realtime current = DataCache.getRealtime(symbol);
if (current == null || current.getTs() != event.getTs()) {
@@ -135,19 +138,22 @@
realtime.setAmount(realtime.getAmount().multiply(item.getMultiple()));
}
- if (high != null && high >= realtime.getClose().doubleValue()) {
+ /*if (high != null && high >= realtime.getClose().doubleValue()) {
realtime.setHigh(new BigDecimal(high));
}
if (low != null && low <= realtime.getClose().doubleValue()) {
realtime.setLow(new BigDecimal(low));
- }
+ }*/
- Double h24Before = DataCache.getRealtime24HBeforeOpen().get(symbol);
+ /*ouble h24Before = DataCache.getRealtime24HBeforeOpen().get(symbol);
if (h24Before != null) {
realtime.setOpen(new BigDecimal(h24Before));
- }
+ }*/
+ /*if (realtime.getSymbol().equals("galausdt")) {
+ System.out.println("galausdt222" + realtime);
+ }*/
DataCache.putRealtime(symbol, realtime);
// System.out.println(JSONObject.toJSONString(realtime));
}
--
Gitblit v1.9.3