feat: 调整结果展示
This commit is contained in:
@@ -35,7 +35,6 @@ public class PyramidStockSelector implements StockSelector<PyramidStockSelector.
|
|||||||
// 选择至少有最近5年财报的股票
|
// 选择至少有最近5年财报的股票
|
||||||
// 有点奇怪,001400.SZ有近5年的财报但资料显示是2025年才上市的
|
// 有点奇怪,001400.SZ有近5年的财报但资料显示是2025年才上市的
|
||||||
var stocks = stockRepository.findAll(QStock.stock.listedDate.before(LocalDate.of(request.year(), 1, 1)));
|
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));
|
var scores = stocks.stream().collect(Collectors.toMap(stock -> stock, code -> 0));
|
||||||
for (Stock stock : stocks) {
|
for (Stock stock : stocks) {
|
||||||
var recentIndicators = stock.getIndicators()
|
var recentIndicators = stock.getIndicators()
|
||||||
|
|||||||
@@ -35,11 +35,19 @@ public class PyramidSelect extends TaskRunner {
|
|||||||
@Override
|
@Override
|
||||||
public String process(Map<String, Object> params, StepUpdater updater) throws Exception {
|
public String process(Map<String, Object> params, StepUpdater updater) throws Exception {
|
||||||
var candidates = pyramidStockSelector.select(new PyramidStockSelector.Request(LocalDate.now().getYear(), 50));
|
var candidates = pyramidStockSelector.select(new PyramidStockSelector.Request(LocalDate.now().getYear(), 50));
|
||||||
|
|
||||||
var collection = new StockCollection();
|
var collection = new StockCollection();
|
||||||
collection.setName("金字塔选股");
|
collection.setName("金字塔选股");
|
||||||
collection.setDescription("金字塔选股");
|
collection.setDescription("金字塔选股");
|
||||||
collection.setStocks(candidates.stream().map(StockSelector.Candidate::stock).collect(Collectors.toSet()));
|
collection.setStocks(candidates.stream().map(StockSelector.Candidate::stock).collect(Collectors.toSet()));
|
||||||
stockCollectionRepository.save(collection);
|
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")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
14
leopard-server/src/main/resources/application-h2.yml
Normal file
14
leopard-server/src/main/resources/application-h2.yml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
url: jdbc:h2:file:./leopard;DB_CLOSE_ON_EXIT=TRUE
|
||||||
|
username: leopard
|
||||||
|
password: leopard
|
||||||
|
driver-class-name: org.h2.Driver
|
||||||
|
quartz:
|
||||||
|
jdbc:
|
||||||
|
platform: h2
|
||||||
|
properties:
|
||||||
|
org:
|
||||||
|
quartz:
|
||||||
|
jobStore:
|
||||||
|
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
|
||||||
@@ -56,9 +56,10 @@ function TaskDetail() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
visibleOn: 'result',
|
visibleOn: 'result',
|
||||||
type: 'editor',
|
type: 'markdown-enhance',
|
||||||
name: 'result',
|
name: 'result',
|
||||||
label: '结果',
|
label: '结果',
|
||||||
|
content: '${result}',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user