Skip to content

Commit

Permalink
write etf
Browse files Browse the repository at this point in the history
  • Loading branch information
thedestiny committed Jun 24, 2024
1 parent 36bfc8b commit 2b9ffab
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions sandbox-stock/src/main/java/com/platform/task/StockTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.platform.entity.EtfInfo;
import com.platform.entity.StockInfo;
import com.platform.service.StockService;
import com.platform.utils.HuaUtils;
import com.platform.utils.SnowStockUtils;
import com.platform.utils.TianFundUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
Expand Down Expand Up @@ -39,7 +42,7 @@ public class StockTask {
public void task() {
log.info("start task !");
Integer total = 0;
for (int i = 0; i < 57; i++) {
for (int i = 0; i < 60; i++) {
List<StockInfo> stockInfos = SnowStockUtils.queryStockList(i + 1, 90);
if (CollUtil.isEmpty(stockInfos)) {
return;
Expand All @@ -64,10 +67,25 @@ public void task() {
} catch (Exception e) {
log.error("code is node {} error {}",JSONObject.toJSONString(node), e.getMessage(), e);
}

}
}
}


@Scheduled(cron = "0 */10 * * * ?")
public void taskEtf() {
log.info("start etf task !");
try {

List<EtfInfo> etfInfos = TianFundUtils.etfInfoList();
List<EtfInfo> result = HuaUtils.captureEtf();

service.saveEtfInfoList(etfInfos);
service.saveEtfInfoList(result);

}catch (Exception e){

}
}

}

0 comments on commit 2b9ffab

Please sign in to comment.