From f5e6133809c553cfd9fb28ee61019927c547c374 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Wed, 08 Dec 2021 15:58:33 +0800 Subject: [PATCH] 20211208 fish --- src/main/java/com/xcong/excoin/modules/exchange/service/impl/HandleKlineServiceImpl.java | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/xcong/excoin/modules/exchange/service/impl/HandleKlineServiceImpl.java b/src/main/java/com/xcong/excoin/modules/exchange/service/impl/HandleKlineServiceImpl.java index 86891ac..ec776b7 100644 --- a/src/main/java/com/xcong/excoin/modules/exchange/service/impl/HandleKlineServiceImpl.java +++ b/src/main/java/com/xcong/excoin/modules/exchange/service/impl/HandleKlineServiceImpl.java @@ -57,25 +57,31 @@ if(exchangeTrade==null){ continue; } - min=exchangeTrade.getPrice().min(min); + if(min.compareTo(BigDecimal.ZERO)==0){ + min = exchangeTrade.getPrice(); + }else{ + min=exchangeTrade.getPrice().min(min); + } max=exchangeTrade.getPrice().max(max); vol=vol.add(exchangeTrade.getAmount()); } Object o = redisUtils.get(symbolUsdt); if(o!=null){ Candlestick today = (Candlestick)o; + today.setVolume(today.getVolume()==null?BigDecimal.ZERO:today.getVolume()); today.setHigh(today.getHigh().max(max)); today.setLow(today.getLow().min(min)); - today.setLow(today.getVolume().add(vol)); + today.setVolume(today.getVolume().add(vol)); redisUtils.set(symbolUsdt,today); }else{ Candlestick today = new Candlestick(); today.setClose(newPrice); today.setLow(newPrice); today.setHigh(newPrice); + today.setVolume(BigDecimal.ZERO); today.setHigh(today.getHigh().max(max)); today.setLow(today.getLow().min(min)); - today.setLow(vol); + today.setVolume(vol); redisUtils.set(symbolUsdt,today); } // 存入redis,websocket去取 -- Gitblit v1.9.1