| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.huobi.client.model.Candlestick; |
| | | import com.xcong.excoin.common.contants.AppContants; |
| | | import com.xcong.excoin.modules.symbols.constants.SymbolsConstats; |
| | | import com.xcong.excoin.trade.CoinTraderFactory; |
| | | import com.xcong.excoin.utils.CoinTypeConvert; |
| | | import com.xcong.excoin.utils.RedisUtils; |
| | |
| | | JSONObject jsonObject = JSON.parseObject(message); |
| | | // 盘口的判断 |
| | | if (jsonObject.containsKey("sub") && jsonObject.get("sub").toString().contains("depth")) { |
| | | |
| | | String sub = jsonObject.get("sub").toString(); |
| | | String symbol = sub.split("\\.")[1]; |
| | | symbol = CoinTypeConvert.convert(symbol); |
| | |
| | | // 发送一次盘口 |
| | | CoinTraderFactory factory = SpringContextHolder.getBean(CoinTraderFactory.class); |
| | | // 发送订阅消息 |
| | | String nekk = factory.getTrader("NEKK").sendTradePlateMessage(); |
| | | String nekk = factory.getTrader(SymbolsConstats.ROC).sendTradePlateMessage(); |
| | | SubResultModel subResultModel = new SubResultModel(); |
| | | subResultModel.setId("nekkusdt"); |
| | | subResultModel.setId("rocusdt"); |
| | | subResultModel.setSubbed(sub); |
| | | synchronized (session){ |
| | | try { |
| | |
| | | String key = "KINE_{}_{}"; |
| | | // 币币k线数据 |
| | | //key = StrUtil.format(key, symbol, period); |
| | | key = StrUtil.format(key, "NEKK/USDT", period); |
| | | key = StrUtil.format(key, "ROC/USDT", period); |
| | | RedisUtils bean = SpringContextHolder.getBean(RedisUtils.class); |
| | | Object o = bean.get(key); |
| | | List<CandlestickModel> candlestickModels = new ArrayList<>(); |