| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.yami.trading.bean.data.domain.Kline; |
| | | import com.yami.trading.bean.data.dto.BeforeClose; |
| | | import com.yami.trading.bean.ico.domain.Ico; |
| | | import com.yami.trading.bean.item.domain.Item; |
| | | import com.yami.trading.common.domain.Result; |
| | |
| | | import com.yami.trading.common.util.DateUtils; |
| | | import com.yami.trading.common.web.ResultObject; |
| | | import com.yami.trading.huobi.data.AdjustmentValueCache; |
| | | import com.yami.trading.huobi.data.internal.DataDBService; |
| | | import com.yami.trading.huobi.data.internal.KlineService; |
| | | import com.yami.trading.service.data.DataService; |
| | | import com.yami.trading.service.etf.MarketService; |
| | |
| | | private DataService dataService; |
| | | @Autowired |
| | | private IcoService icoService; |
| | | |
| | | @Autowired |
| | | private DataDBService dataDBService; |
| | | |
| | | @ApiOperation(value = "行情") |
| | | @GetMapping(HOBI + "getKline.action") |
| | |
| | | } |
| | | } |
| | | |
| | | BigDecimal currentValue = AdjustmentValueCache.getCurrentValue().get(symbol); |
| | | /*BigDecimal currentValue = AdjustmentValueCache.getCurrentValue().get(symbol); |
| | | if (currentValue != null) { |
| | | data.forEach(kline -> { |
| | | /*logger.info("==currentValue==close:{}, low:{}, high:{}, open:{}, currentValue:{}", |
| | | kline.getClose(), kline.getLow(), kline.getHigh(), kline.getOpen(), currentValue);*/ |
| | | *//*logger.info("==currentValue==close:{}, low:{}, high:{}, open:{}, currentValue:{}", |
| | | kline.getClose(), kline.getLow(), kline.getHigh(), kline.getOpen(), currentValue);*//* |
| | | if (!kline.isAdjusted()){ |
| | | if (kline.getClose().compareTo(kline.getLow()) >= 0 && kline.getClose().compareTo(kline.getHigh()) <= 0) { |
| | | kline.setClose(kline.getClose().add(currentValue)); |
| | |
| | | kline.setAdjusted(true); |
| | | } |
| | | }); |
| | | } |
| | | }*/ |
| | | return Result.succeed(this.build(data, line, symbol)); |
| | | } catch (Exception e) { |
| | | logger.error("getKline error", e); |
| | |
| | | map.put("high", high.setScale(decimal, RoundingMode.HALF_UP)); |
| | | map.put("low", low.setScale(decimal, RoundingMode.HALF_UP)); |
| | | map.put("volume", kline.getVolume()); |
| | | |
| | | if (line.equalsIgnoreCase(Kline.PERIOD_15MIN) || line.equalsIgnoreCase(Kline.PERIOD_30MIN) || line.equalsIgnoreCase(Kline.PERIOD_60MIN)) { |
| | | if (i == data.size() - 1) { |
| | | BeforeClose beforeClose = dataDBService.getBeforeClose(kline.getSymbol(), line, ts); |
| | | if (beforeClose != null) { |
| | | map.put("high", beforeClose.getMaxClose().setScale(decimal, RoundingMode.HALF_UP)); |
| | | map.put("low", beforeClose.getMinClose().setScale(decimal, RoundingMode.HALF_UP)); |
| | | } |
| | | } |
| | | } |
| | | list.add(map); |
| | | } |
| | | return list; |