1
0

feat: 调整结果展示

This commit is contained in:
2025-09-26 18:13:12 +08:00
parent d4fec4c426
commit d3f337e2c4
4 changed files with 25 additions and 3 deletions

View File

@@ -35,7 +35,6 @@ public class PyramidStockSelector implements StockSelector<PyramidStockSelector.
// 选择至少有最近5年财报的股票
// 有点奇怪001400.SZ有近5年的财报但资料显示是2025年才上市的
var stocks = stockRepository.findAll(QStock.stock.listedDate.before(LocalDate.of(request.year(), 1, 1)));
log.info("Year: {} Stock: {}", request.year(), stocks.size());
var scores = stocks.stream().collect(Collectors.toMap(stock -> stock, code -> 0));
for (Stock stock : stocks) {
var recentIndicators = stock.getIndicators()

View File

@@ -35,11 +35,19 @@ public class PyramidSelect extends TaskRunner {
@Override
public String process(Map<String, Object> params, StepUpdater updater) throws Exception {
var candidates = pyramidStockSelector.select(new PyramidStockSelector.Request(LocalDate.now().getYear(), 50));
var collection = new StockCollection();
collection.setName("金字塔选股");
collection.setDescription("金字塔选股");
collection.setStocks(candidates.stream().map(StockSelector.Candidate::stock).collect(Collectors.toSet()));
stockCollectionRepository.save(collection);
return null;
return """
| Code | Name | Score |
| ---- | ---- | ----- |
%s
""".formatted(candidates.stream()
.map(candidate -> "| %s | %s | %.2f |".formatted(candidate.stock().getCode(), candidate.stock().getName(), candidate.score()))
.collect(Collectors.joining("\n")));
}
}