| | |
| | | import com.xcong.excoin.modules.coin.service.OrderCoinService; |
| | | import com.xcong.excoin.processor.CoinProcessorFactory; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | @ConditionalOnProperty(prefix = "app", name = "exchange-trade", havingValue = "true") |
| | | public class KLineGeneratorJob { |
| | | @Resource |
| | | private CoinProcessorFactory processorFactory; |
| | | |
| | | @Resource |
| | | private OrderCoinService orderCoinService; |
| | | |
| | | |
| | | |
| | | //@Scheduled(cron = "0/40 * * * * *") |
| | | public void test(){ |
| | | Random random = new Random(); |
| | | Integer type = OrderCoinsDealEntity.ORDERTYPE_BUY; |
| | | Integer tradeType = OrderCoinsDealEntity.TRADETYPE_FIXEDPRICE; |
| | | double random1 = Math.random(); |
| | | BigDecimal price = new BigDecimal(random1).setScale(4, RoundingMode.HALF_UP).multiply(new BigDecimal("2")); |
| | | if(price.compareTo(BigDecimal.ZERO)==0){ |
| | | price = BigDecimal.ONE; |
| | | } |
| | | System.out.println(price); |
| | | orderCoinService.initOrders("ROC",type,tradeType,price,new BigDecimal(2),null); |
| | | orderCoinService.initOrders("ROC",OrderCoinsDealEntity.ORDERTYPE_SELL,tradeType,price,new BigDecimal(2),null); |
| | | } |
| | | |
| | | |
| | | /** |