| | |
| | | package com.xcong.excoin.quartz.job; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.huobi.client.SubscriptionClient; |
| | | import com.huobi.client.SubscriptionOptions; |
| | | import com.huobi.client.model.Candlestick; |
| | | import com.huobi.client.model.enums.CandlestickInterval; |
| | | import com.xcong.excoin.modules.coin.dao.OrderCoinDealDao; |
| | | import com.xcong.excoin.modules.coin.dao.OrderCoinsDao; |
| | | import com.xcong.excoin.modules.coin.entity.OrderCoinsEntity; |
| | | import com.xcong.excoin.modules.coin.service.OrderCoinService; |
| | |
| | | import com.xcong.excoin.rabbit.producer.ExchangeProducer; |
| | | import com.xcong.excoin.trade.CoinTrader; |
| | | import com.xcong.excoin.trade.CoinTraderFactory; |
| | | import com.xcong.excoin.trade.ExchangeTrade; |
| | | import com.xcong.excoin.utils.CoinTypeConvert; |
| | | import com.xcong.excoin.utils.RedisUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import java.text.ParseException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 开启撮合交易 |
| | |
| | | |
| | | @Resource |
| | | private OrderCoinsDao orderCoinsDao; |
| | | @Resource |
| | | private OrderCoinDealDao orderCoinDealDao; |
| | | |
| | | @Resource |
| | | private CoinTraderFactory factory; |
| | | |
| | | @Resource |
| | | private OrderCoinService coinService; |
| | | private RedisUtils redisUtils; |
| | | |
| | | @Resource |
| | | private MarketService marketService; |
| | |
| | | processor.initializeThumb(); |
| | | //processor.initializeUsdRate(); |
| | | processor.setIsHalt(false); |
| | | List<ExchangeTrade> nekk = orderCoinDealDao.selectOrderCoinDealByTime("NEKK", null, null); |
| | | processor.process(nekk); |
| | | String symbolUsdt = symbol; |
| | | if(!symbol.contains("USDT")){ |
| | | symbolUsdt = symbol+"/USDT"; |
| | | } |
| | | String key = "NEW_KINE_{}"; |
| | | key = StrUtil.format(key, symbolUsdt); |
| | | Object o = redisUtils.get(key); |
| | | if(o!=null){ |
| | | Map<String, Candlestick> currentKlineMap = (Map<String, Candlestick> )o; |
| | | ((DefaultCoinProcessor) processor).setCurrentKlineMap(currentKlineMap); |
| | | } |
| | | |
| | | processorFactory.addProcessor(symbol, processor); |
| | | |
| | | } |
| | | } |