| | |
| | | package com.xcong.excoin.modules.symbols.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.huobi.client.model.Candlestick; |
| | | import com.xcong.excoin.common.contants.AppContants; |
| | | import com.xcong.excoin.common.enumerates.SymbolEnum; |
| | | import com.xcong.excoin.common.response.Result; |
| | | import com.xcong.excoin.common.system.mapper.CandlestickMapper; |
| | | import com.xcong.excoin.modules.newPrice.ExchangeInfoEnum; |
| | | import com.xcong.excoin.modules.newPrice.ExchangeLoginService; |
| | | import com.xcong.excoin.modules.newPrice.KlineVo; |
| | | import com.xcong.excoin.modules.platform.dao.PlatformCnyUsdtExchangeDao; |
| | | import com.xcong.excoin.modules.platform.entity.PlatformCnyUsdtExchangeEntity; |
| | | import com.xcong.excoin.modules.symbols.parameter.dto.KlineDetailDto; |
| | |
| | | import com.xcong.excoin.modules.symbols.parameter.vo.KlineDataVo; |
| | | import com.xcong.excoin.modules.symbols.service.SymbolsService; |
| | | import com.xcong.excoin.utils.CoinTypeConvert; |
| | | import com.xcong.excoin.utils.MessageSourceUtils; |
| | | import com.xcong.excoin.utils.RedisUtils; |
| | | import com.xcong.excoin.utils.api.ApiClient; |
| | | import com.xcong.excoin.utils.api.response.Kline; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | } |
| | | return Result.fail("获取数据失败"); |
| | | } |
| | | |
| | | @Override |
| | | public Result findKlineList(KlineVo klineDetailDto) { |
| | | Integer type = klineDetailDto.getType(); |
| | | String instId = null; |
| | | if (AppContants.HOME_SYMBOLS_COIN == type){ |
| | | instId = CoinTypeConvert.convertToCoinKlineKey(klineDetailDto.getInstId()); |
| | | }else if (AppContants.HOME_SYMBOLS_CONTRACT == type){ |
| | | instId = CoinTypeConvert.convertToKlineKey(klineDetailDto.getInstId()); |
| | | }else{ |
| | | return Result.fail("参数错误"); |
| | | } |
| | | LinkedHashMap<String, Object> requestParam = new LinkedHashMap<>(); |
| | | requestParam.put("instId",instId); |
| | | String result = ExchangeLoginService.getInstance(ExchangeInfoEnum.OKX_UAT.name()).lineHistory(requestParam); |
| | | log.info("加载OKX-KLINE,{}", result); |
| | | JSONObject json = JSON.parseObject(result); |
| | | String data = json.getString("data"); |
| | | List<String[]> klinesList = JSON.parseArray(data, String[].class); |
| | | return Result.ok(klinesList); |
| | | } |
| | | } |