feat: 增加策略模块专门处理策略研究
This commit is contained in:
1
.idea/compiler.xml
generated
1
.idea/compiler.xml
generated
@@ -96,6 +96,7 @@
|
|||||||
<entry name="$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-configuration-processor/3.5.0/spring-boot-configuration-processor-3.5.0.jar" />
|
<entry name="$MAVEN_REPOSITORY$/org/springframework/boot/spring-boot-configuration-processor/3.5.0/spring-boot-configuration-processor-3.5.0.jar" />
|
||||||
<entry name="$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.38/lombok-1.18.38.jar" />
|
<entry name="$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.38/lombok-1.18.38.jar" />
|
||||||
</processorPath>
|
</processorPath>
|
||||||
|
<module name="leopard-strategy" />
|
||||||
<module name="leopard-server" />
|
<module name="leopard-server" />
|
||||||
</profile>
|
</profile>
|
||||||
</annotationProcessing>
|
</annotationProcessing>
|
||||||
|
|||||||
2
.idea/encodings.xml
generated
2
.idea/encodings.xml
generated
@@ -5,6 +5,8 @@
|
|||||||
<file url="file://$PROJECT_DIR$/leopard-core/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/leopard-core/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/leopard-server/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/leopard-server/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/leopard-server/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/leopard-server/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/leopard-strategy/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/leopard-strategy/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/src/main/kotlin" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/src/main/kotlin" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import jakarta.persistence.Entity;
|
|||||||
import jakarta.persistence.EntityListeners;
|
import jakarta.persistence.EntityListeners;
|
||||||
import jakarta.persistence.EnumType;
|
import jakarta.persistence.EnumType;
|
||||||
import jakarta.persistence.Enumerated;
|
import jakarta.persistence.Enumerated;
|
||||||
|
import jakarta.persistence.ManyToMany;
|
||||||
import jakarta.persistence.OneToMany;
|
import jakarta.persistence.OneToMany;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@@ -61,6 +62,10 @@ public class Stock extends SimpleEntity {
|
|||||||
@ToString.Exclude
|
@ToString.Exclude
|
||||||
private Set<Daily> dailies;
|
private Set<Daily> dailies;
|
||||||
|
|
||||||
|
@ManyToMany
|
||||||
|
@ToString.Exclude
|
||||||
|
private Set<StockCollection> collections;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum Market implements SimpleEnum {
|
public enum Market implements SimpleEnum {
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.lanyuanxiaoyao.leopard.core.entity;
|
||||||
|
|
||||||
|
import com.lanyuanxiaoyao.leopard.core.Constants;
|
||||||
|
import com.lanyuanxiaoyao.service.template.entity.SimpleEntity;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.EntityListeners;
|
||||||
|
import jakarta.persistence.ManyToMany;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import java.util.Set;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.FieldNameConstants;
|
||||||
|
import org.hibernate.annotations.DynamicInsert;
|
||||||
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@FieldNameConstants
|
||||||
|
@Entity
|
||||||
|
@DynamicUpdate
|
||||||
|
@DynamicInsert
|
||||||
|
@EntityListeners(AuditingEntityListener.class)
|
||||||
|
@Table(name = Constants.DATABASE_PREFIX + "stock_collection")
|
||||||
|
public class StockCollection extends SimpleEntity {
|
||||||
|
@Column(nullable = false)
|
||||||
|
private String name;
|
||||||
|
@Column(nullable = false)
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@ManyToMany
|
||||||
|
@ToString.Exclude
|
||||||
|
private Set<Stock> stocks;
|
||||||
|
}
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package com.lanyuanxiaoyao.leopard.server;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 静态字段
|
|
||||||
*
|
|
||||||
* @author lanyuanxiaoyao
|
|
||||||
* @version 20250829
|
|
||||||
*/
|
|
||||||
public interface Constants {
|
|
||||||
String DATABASE_PREFIX = "leopard_";
|
|
||||||
}
|
|
||||||
@@ -1,24 +1,36 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||||
|
|
||||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
<conversionRule conversionWord="clr" class="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||||
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
<conversionRule conversionWord="wex" class="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||||
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
<conversionRule conversionWord="wEx" class="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
||||||
|
|
||||||
<springProperty scope="context" name="LOGGING_PARENT" source="logging.parent"/>
|
<springProperty scope="context" name="LOGGING_PARENT" source="logging.parent"/>
|
||||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name"/>
|
<springProperty scope="context" name="APP_NAME" source="spring.application.name"/>
|
||||||
|
|
||||||
<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<encoder>
|
<encoder>
|
||||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %clr(%5p) %clr([${HOSTNAME}]){yellow} %clr([%t]){magenta} %clr(%logger{40}){cyan}: %m%n%wEx</pattern>
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %clr(%5p) %clr([${HOSTNAME}]){yellow} %clr([%t]){magenta} %clr(%logger{40}){cyan}: %m%n%wEx
|
||||||
|
</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="RollingFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOGGING_PARENT:-.}/${APP_NAME:-run}.log</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOGGING_PARENT:-.}/archive/${APP_NAME:-run}-%d{yyyy-MM-dd}.gz</fileNamePattern>
|
||||||
|
<MaxHistory>7</MaxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %p [${HOSTNAME}] [%t] %logger: %m%n%wEx</pattern>
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<logger name="com.zaxxer.hikari" level="ERROR"/>
|
<logger name="com.zaxxer.hikari" level="ERROR"/>
|
||||||
<logger name="org.hibernate.SQL" level="DEBUG"/>
|
<!--<logger name="org.hibernate.SQL" level="DEBUG"/>-->
|
||||||
<logger name="org.hibernate.type.descriptor.jdbc.BasicBinder" level="TRACE"/>
|
|
||||||
|
|
||||||
<root level="INFO">
|
<root level="INFO">
|
||||||
<appender-ref ref="Console"/>
|
<appender-ref ref="Console"/>
|
||||||
|
<appender-ref ref="RollingFile"/>
|
||||||
</root>
|
</root>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -110,3 +110,96 @@ Content-Type: application/json
|
|||||||
"adj_factor"
|
"adj_factor"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
### Get daily factor
|
||||||
|
POST {{api_url}}
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"api_name": "stk_factor_pro",
|
||||||
|
"token": "{{api_key}}",
|
||||||
|
"params": {
|
||||||
|
"ts_code": "000001.SZ",
|
||||||
|
"trade_date": "20250225"
|
||||||
|
},
|
||||||
|
"fields": [
|
||||||
|
"ts_code",
|
||||||
|
"trade_date",
|
||||||
|
"close",
|
||||||
|
"close_qfq",
|
||||||
|
"close_hfq",
|
||||||
|
"ema_hfq_5"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
### Get income
|
||||||
|
POST {{api_url}}
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"api_name": "income",
|
||||||
|
"token": "{{api_key}}",
|
||||||
|
"params": {
|
||||||
|
"ts_code": "000001.SZ",
|
||||||
|
"period": "20241231"
|
||||||
|
},
|
||||||
|
"fields": [
|
||||||
|
"ts_code",
|
||||||
|
"ann_date",
|
||||||
|
"total_revenue",
|
||||||
|
"int_income"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
### Get cashflow
|
||||||
|
POST {{api_url}}
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"api_name": "cashflow",
|
||||||
|
"token": "{{api_key}}",
|
||||||
|
"params": {
|
||||||
|
"ts_code": "000002.SZ",
|
||||||
|
"period": "20231231"
|
||||||
|
},
|
||||||
|
"fields": [
|
||||||
|
"ann_date",
|
||||||
|
"n_cashflow_act"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
### Get balancesheet
|
||||||
|
POST {{api_url}}
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"api_name": "balancesheet",
|
||||||
|
"token": "{{api_key}}",
|
||||||
|
"params": {
|
||||||
|
"ts_code": "000002.SZ",
|
||||||
|
"period": "20231231"
|
||||||
|
},
|
||||||
|
"fields": [
|
||||||
|
"ann_date",
|
||||||
|
"total_cur_liab",
|
||||||
|
"oth_cur_liab"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
### Get fina_indicator
|
||||||
|
POST {{api_url}}
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"api_name": "fina_indicator",
|
||||||
|
"token": "{{api_key}}",
|
||||||
|
"params": {
|
||||||
|
"ts_code": "000002.SZ",
|
||||||
|
"period": "20231231"
|
||||||
|
},
|
||||||
|
"fields": [
|
||||||
|
"ann_date",
|
||||||
|
"ocf_to_shortdebt",
|
||||||
|
"currentdebt_to_debt"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|||||||
86
leopard-strategy/pom.xml
Normal file
86
leopard-strategy/pom.xml
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.lanyuanxiaoyao</groupId>
|
||||||
|
<artifactId>leopard</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>leopard-strategy</artifactId>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.lanyuanxiaoyao</groupId>
|
||||||
|
<artifactId>leopard-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.github.ralfkonrad.quantlib_for_maven</groupId>
|
||||||
|
<artifactId>quantlib</artifactId>
|
||||||
|
<version>1.39.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.ta4j</groupId>
|
||||||
|
<artifactId>ta4j-core</artifactId>
|
||||||
|
<version>0.17</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.postgresql</groupId>
|
||||||
|
<artifactId>postgresql</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<annotationProcessorPaths>
|
||||||
|
<path>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||||
|
</path>
|
||||||
|
<path>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</path>
|
||||||
|
</annotationProcessorPaths>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<excludes>
|
||||||
|
<exclude>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</exclude>
|
||||||
|
</excludes>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.lanyuanxiaoyao.leopard.strategy;
|
||||||
|
|
||||||
|
import com.lanyuanxiaoyao.leopard.core.entity.Daily;
|
||||||
|
import com.lanyuanxiaoyao.leopard.core.entity.Daily_;
|
||||||
|
import com.lanyuanxiaoyao.leopard.core.entity.QDaily;
|
||||||
|
import com.lanyuanxiaoyao.leopard.core.repository.DailyRepository;
|
||||||
|
import com.lanyuanxiaoyao.leopard.core.repository.StockRepository;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||||
|
import org.springframework.context.event.EventListener;
|
||||||
|
import org.springframework.data.domain.Sort;
|
||||||
|
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
|
||||||
|
import org.ta4j.core.BaseBar;
|
||||||
|
import org.ta4j.core.BaseBarSeriesBuilder;
|
||||||
|
import org.ta4j.core.indicators.EMAIndicator;
|
||||||
|
import org.ta4j.core.indicators.helpers.ClosePriceIndicator;
|
||||||
|
import org.ta4j.core.num.DoubleNum;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@SpringBootApplication(scanBasePackages = "com.lanyuanxiaoyao.leopard")
|
||||||
|
@EnableJpaAuditing
|
||||||
|
public class StrategyApplication {
|
||||||
|
@Resource
|
||||||
|
private StockRepository stockRepository;
|
||||||
|
@Resource
|
||||||
|
private DailyRepository dailyRepository;
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(StrategyApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackOn = Throwable.class)
|
||||||
|
@EventListener(ApplicationReadyEvent.class)
|
||||||
|
public void test() {
|
||||||
|
var dailies = dailyRepository.findAll(QDaily.daily.stock.code.eq("000001.SZ"), Sort.by(Daily_.TRADE_DATE));
|
||||||
|
var series = new BaseBarSeriesBuilder()
|
||||||
|
.withNumTypeOf(DoubleNum.class)
|
||||||
|
.build();
|
||||||
|
log.info("{}", dailies.size());
|
||||||
|
for (Daily daily : dailies) {
|
||||||
|
series.addBar(new BaseBar(
|
||||||
|
Duration.ofDays(1),
|
||||||
|
daily.getTradeDate().plusDays(1).atStartOfDay(ZoneId.systemDefault()),
|
||||||
|
DoubleNum.valueOf(daily.getOpen() * daily.getFactor()),
|
||||||
|
DoubleNum.valueOf(daily.getHigh() * daily.getFactor()),
|
||||||
|
DoubleNum.valueOf(daily.getLow() * daily.getFactor()),
|
||||||
|
DoubleNum.valueOf(daily.getClose() * daily.getFactor()),
|
||||||
|
DoubleNum.valueOf(daily.getVolume()),
|
||||||
|
DoubleNum.valueOf(daily.getPriceChangeAmount()),
|
||||||
|
daily.getTurnover().longValue()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
var ema = new EMAIndicator(new ClosePriceIndicator(series), 5);
|
||||||
|
var emaValues = ema.stream().toList();
|
||||||
|
log.info("{}", emaValues.size());
|
||||||
|
|
||||||
|
for (int index = 0; index < dailies.size(); index++) {
|
||||||
|
var daily = dailies.get(index);
|
||||||
|
var emaValue = emaValues.get(index);
|
||||||
|
log.info("{} {} {} {} {}", daily.getTradeDate().toString(), daily.getClose(), daily.getFactor(), daily.getClose() * daily.getFactor(), emaValue.doubleValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
23
leopard-strategy/src/main/resources/logback-spring.xml
Normal file
23
leopard-strategy/src/main/resources/logback-spring.xml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<configuration>
|
||||||
|
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||||
|
|
||||||
|
<conversionRule conversionWord="clr" class="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||||
|
<conversionRule conversionWord="wex" class="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||||
|
<conversionRule conversionWord="wEx" class="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
||||||
|
|
||||||
|
<springProperty scope="context" name="LOGGING_PARENT" source="logging.parent"/>
|
||||||
|
<springProperty scope="context" name="APP_NAME" source="spring.application.name"/>
|
||||||
|
|
||||||
|
<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %clr(%5p) %clr([${HOSTNAME}]){yellow} %clr([%t]){magenta} %clr(%logger{40}){cyan}: %m%n%wEx</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<logger name="com.zaxxer.hikari" level="ERROR"/>
|
||||||
|
<logger name="org.hibernate.SQL" level="DEBUG"/>
|
||||||
|
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="Console"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.lanyuanxiaoyao.leopard.strategy;
|
||||||
|
|
||||||
|
import com.lanyuanxiaoyao.leopard.core.repository.StockRepository;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@DataJpaTest
|
||||||
|
public class TestMaCalculate {
|
||||||
|
private final StockRepository stockRepository;
|
||||||
|
|
||||||
|
public TestMaCalculate(StockRepository stockRepository) {
|
||||||
|
this.stockRepository = stockRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test() {
|
||||||
|
var total = stockRepository.count();
|
||||||
|
log.info("Total: {}", total);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user