| | |
| | | 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.modules.symbols.constants.SymbolsConstats; |
| | | import com.xcong.excoin.modules.symbols.service.SymbolsService; |
| | | import com.xcong.excoin.processor.CoinProcessor; |
| | | import com.xcong.excoin.processor.CoinProcessorFactory; |
| | |
| | | **/ |
| | | @Slf4j |
| | | @Component |
| | | //@ConditionalOnProperty(prefix = "app", name = "trade", havingValue = "true") |
| | | @ConditionalOnProperty(prefix = "app", name = "exchange-trade", havingValue = "true") |
| | | public class CoinTradeInitJob { |
| | | |
| | | @Resource |
| | |
| | | @PostConstruct |
| | | public void initCoinTrade() { |
| | | log.info("#=======撮合交易器开启=======#"); |
| | | String symbol = "NEKK"; |
| | | String symbol = SymbolsConstats.RFNC; |
| | | CoinTrader newTrader = new CoinTrader(symbol); |
| | | newTrader.setExchangeProducer(exchangeProducer); |
| | | //newTrader.setKafkaTemplate(kafkaTemplate); |
| | |
| | | List<OrderCoinsEntity> tradingOrders = new ArrayList<>(); |
| | | List<OrderCoinsEntity> completedOrders = new ArrayList<>(); |
| | | orders.forEach(order -> { |
| | | if(order.getDealCnt()==null){ |
| | | order.setDealCnt(BigDecimal.ZERO); |
| | | } |
| | | if(order.getDealAmount()==null){ |
| | | order.setDealAmount(BigDecimal.ZERO); |
| | | } |
| | | tradingOrders.add(order); |
| | | }); |
| | | try { |
| | |
| | | // 创建K线生成器 |
| | | CoinProcessor processor = new DefaultCoinProcessor(symbol, "USDT"); |
| | | processor.setMarketService(marketService); |
| | | processor.setRedisUtils(redisUtils); |
| | | //processor.setExchangeRate(exchangeRate); |
| | | processor.initializeThumb(); |
| | | //processor.initializeUsdRate(); |
| | | processor.setIsHalt(false); |
| | | List<ExchangeTrade> nekk = orderCoinDealDao.selectOrderCoinDealByTime("NEKK", null, null); |
| | | List<ExchangeTrade> nekk = orderCoinDealDao.selectOrderCoinDealByTime(SymbolsConstats.RFNC, null, null); |
| | | processor.process(nekk); |
| | | String symbolUsdt = symbol; |
| | | if(!symbol.contains("USDT")){ |