From 0ac5d713b3838c5147516a6949d506d002305a98 Mon Sep 17 00:00:00 2001 From: zainali5120 <512061637@qq.com> Date: Sat, 17 Oct 2020 13:37:14 +0800 Subject: [PATCH] 最高最低价修复 --- src/main/java/com/xcong/excoin/modules/exchange/service/impl/HandleKlineServiceImpl.java | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 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 4fd7abd..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,13 +57,18 @@ 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.setVolume(today.getVolume().add(vol)); @@ -73,9 +78,10 @@ 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