| | |
| | | @Override |
| | | public void saveOneByHuoBi(String symbol, String line) { |
| | | RequestDataHelper.set("symbol", symbol); |
| | | List<Kline> list = hobiDataService.kline(itemService.findBySymbol(symbol).getSymbol(), line, 1, |
| | | List<Kline> list = hobiDataService.kline(itemService.findBySymbol(symbol).getSymbol(), line, 2, |
| | | 0); |
| | | if (list == null || list.isEmpty()) { |
| | | return; |
| | |
| | | kline.setLow(kline.getLow().add(currentValue)); |
| | | kline.setHigh(kline.getHigh().add(currentValue)); |
| | | kline.setAdjusted(true); |
| | | |
| | | BigDecimal last = AdjustmentValueCache.getLastValue().get(symbol); |
| | | if (last != null && last.compareTo(BigDecimal.ZERO) > 0) { |
| | | BigDecimal adj = currentValue.subtract(last); |
| | | if (adj.compareTo(BigDecimal.ZERO) > 0) { //递增 |
| | | kline.setOpen(kline.getOpen().subtract(adj)); |
| | | kline.setLow(kline.getLow().subtract(adj)); |
| | | } else if(adj.compareTo(BigDecimal.ZERO) < 0){ //递减 |
| | | kline.setOpen(kline.getOpen().subtract(adj)); |
| | | kline.setHigh(kline.getHigh().subtract(adj)); |
| | | } |
| | | } else { |
| | | AdjustmentValueCache.getLastValue().put(symbol, currentValue); |
| | | } |
| | | } |
| | | } |
| | | klineDBService.save(kline); |