| | |
| | | CoinProcessor processor = processorFactory.getProcessor(symbol); |
| | | Map<String, Candlestick> currentKlineMap = processor.getCurrentKlineMap(); |
| | | Collection<Candlestick> values = currentKlineMap.values(); |
| | | BigDecimal newPrice = trades.get(trades.size()-1).getPrice(); |
| | | BigDecimal newPrice =null; |
| | | for (Candlestick candlestick : values) { |
| | | for (ExchangeTrade exchangeTrade : trades) { |
| | | if(exchangeTrade==null){ |
| | | continue; |
| | | } |
| | | processor.processTrade(candlestick, exchangeTrade); |
| | | newPrice=exchangeTrade.getPrice(); |
| | | } |
| | | } |
| | | |
| | |
| | | key = StrUtil.format(key, symbolUsdt); |
| | | redisUtils.set(key,currentKlineMap); |
| | | // 更新最新价 |
| | | redisUtils.set(CoinTypeConvert.convertToKey(symbolUsdt), newPrice); |
| | | if(newPrice!=null){ |
| | | redisUtils.set(CoinTypeConvert.convertToKey(symbolUsdt), newPrice); |
| | | } |
| | | |
| | | } |
| | | } |