-
Notifications
You must be signed in to change notification settings - Fork 2
[BE] SISC1-56 [FEAT] 백테스팅 실행 api 구현 #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
The head ref may contain hidden characters: "SISC1-56-BE-\uBC31\uD14C\uC2A4\uD305-\uC2E4\uD589-API-\uAD6C\uD604"
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0fe61e1
[BE] SISC1-56 [FEAT] 백테스트 실행 로직 구현
discipline24 7df6f56
[BE] SISC1-56 [FEAT] 외부 DB의 주식 정보 이용을 위한 멀티 데이터소스 구현
discipline24 2652c9b
[BE] SISC1-56 [FIX] @AuthenticationPrincipal 작동 안되는 문제 해결
discipline24 050c320
Merge branch 'main' into SISC1-56-BE-백테스팅-실행-API-구현
discipline24 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 16 additions & 2 deletions
18
backend/src/main/java/org/sejongisc/backend/backtest/dto/BacktestResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,33 @@ | ||
| package org.sejongisc.backend.backtest.dto; | ||
|
|
||
| import jakarta.persistence.*; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
| import org.hibernate.annotations.JdbcTypeCode; | ||
| import org.hibernate.type.SqlTypes; | ||
| import org.sejongisc.backend.backtest.entity.BacktestRun; | ||
| import org.sejongisc.backend.backtest.entity.BacktestRunMetrics; | ||
| import org.sejongisc.backend.backtest.entity.BacktestStatus; | ||
| import org.sejongisc.backend.template.entity.Template; | ||
| import org.sejongisc.backend.user.entity.User; | ||
|
|
||
| import java.time.LocalDate; | ||
|
|
||
|
|
||
| @Getter | ||
| @Builder | ||
| @AllArgsConstructor | ||
| @NoArgsConstructor | ||
| public class BacktestResponse { | ||
| private BacktestRun backtestRun; | ||
| private BacktestRunMetrics backtestRunMetrics; | ||
| private Long id; | ||
| private Template template; | ||
| private String title; | ||
| private BacktestStatus status; | ||
| private String paramsJson; | ||
| private LocalDate startDate; | ||
| private LocalDate endDate; | ||
|
|
||
| private BacktestRunMetrics backtestRunMetrics; | ||
| } |
39 changes: 39 additions & 0 deletions
39
backend/src/main/java/org/sejongisc/backend/backtest/dto/BacktestRunRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| package org.sejongisc.backend.backtest.dto; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| import java.math.BigDecimal; | ||
| import java.time.LocalDate; | ||
| import java.util.List; | ||
|
|
||
| /** | ||
| * 백테스트 실행 요청 시 Body에 담길 메인 DTO | ||
| * (이 객체가 BacktestRun.paramsJson에 직렬화되어 저장됨) | ||
| */ | ||
| @Getter | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| public class BacktestRunRequest { | ||
| @Schema(description = "초기 자본금") | ||
| private BigDecimal initialCapital; | ||
|
|
||
| @Schema(description = "대상 종목 티커") | ||
| private String ticker; | ||
|
|
||
| @Schema(description = "매수 조건 그룹") | ||
| private List<StrategyCondition> buyConditions; | ||
|
|
||
| @Schema(description = "매도 조건 그룹") | ||
| private List<StrategyCondition> sellConditions; | ||
|
|
||
| @Schema(description = "노트") | ||
| private String note; | ||
|
|
||
| /* | ||
| * 타임 프레임 (예: "D", "W", "M") | ||
| private String timeFrame; | ||
| */ | ||
| } |
31 changes: 31 additions & 0 deletions
31
backend/src/main/java/org/sejongisc/backend/backtest/dto/StrategyCondition.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| package org.sejongisc.backend.backtest.dto; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| /** | ||
| * 전략 조건 한 줄 (Operand + Operator + Operand) | ||
| * 예: [SMA(20)] [GT] [Close] | ||
| */ | ||
| @Getter | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| public class StrategyCondition { | ||
|
|
||
| // 좌항 | ||
| private StrategyOperand leftOperand; | ||
|
|
||
| // 연산자 (예: "GT", "LT", "CROSSES_ABOVE") | ||
| private String operator; | ||
|
|
||
| // 우항 | ||
| private StrategyOperand rightOperand; | ||
|
|
||
| /** | ||
| * "무조건 행동" 조건인지 여부 | ||
| * true = 이 조건이 맞으면 다른 '일반' 조건 무시 | ||
| * false = '일반' 조건 | ||
| */ | ||
| private boolean isAbsolute; | ||
| } |
39 changes: 39 additions & 0 deletions
39
backend/src/main/java/org/sejongisc/backend/backtest/dto/StrategyOperand.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| package org.sejongisc.backend.backtest.dto; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| import java.math.BigDecimal; | ||
| import java.util.Map; | ||
|
|
||
| /** | ||
| * 전략 조건의 개별 항 (Operand) | ||
| * 예: SMA(20), 종가(Close), 30(상수) | ||
| */ | ||
| @Getter | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| public class StrategyOperand { | ||
|
|
||
| // 항의 타입: "indicator", "price", "const" | ||
| private String type; | ||
|
|
||
| // type == "indicator" 일 때 | ||
| // 지표 코드 (예: "SMA", "RSI", "MACD") | ||
| private String indicatorCode; | ||
|
|
||
| // type == "price" 일 때 | ||
| // 가격 필드 (예: "Close", "Open", "High", "Low", "Volume") | ||
| private String priceField; | ||
|
|
||
| // type == "const" 일 때 | ||
| // 상수 값 (예: 30, 0.02) | ||
| private BigDecimal constantValue; | ||
|
|
||
| // 지표의 출력값 (예: "value", "macd", "signal", "hist") | ||
| private String output; | ||
|
|
||
| // 지표의 파라미터 맵 (예: {"length": 20}) | ||
| private Map<String, Object> params; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
backend/src/main/java/org/sejongisc/backend/backtest/entity/BacktestStatus.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package org.sejongisc.backend.backtest.entity; | ||
|
|
||
| public enum BacktestStatus { | ||
| PENDING, | ||
| RUNNING, | ||
| COMPLETED, | ||
| FAILED | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
ta4j-core 버전 최신성 확인 및 BOM 연동 고려
백테스팅 라이브러리 추가는 👍. 다만 0.15가 현재 기준 최신 안정판인지 확인해 주세요. Spring BOM에 의해 관리되지 않는 아티팩트라 주기적 점검이 필요합니다. 필요 시 버전 카탈로그(gradle/libs.versions.toml)나 dependencyManagement에 명시적으로 등록을 권장합니다.
🌐 Web query:
💡 Result:
The latest stable version is 0.18. [1][2]
Sources:
[1] GitHub ta4j README (shows dependency version 0.18).
[2] MVNRepository listing for org.ta4j:ta4j-core — 0.18 (May 15, 2025).
org.ta4j:ta4j-core 버전 업그레이드 필요
현재 지정된 0.15 버전은 더 이상 최신 안정판이 아닙니다. 최신 안정 버전은 0.18입니다(2025년 5월 출시). 0.15에서 0.18로 업그레이드하여 호환성 개선과 잠재적 보안 업데이트를 적용해 주세요. 이 아티팩트는 Spring BOM의 관리 대상이 아니므로, 버전 카탈로그(gradle/libs.versions.toml)나 dependencyManagement 블록에 명시적으로 등록하여 장기 유지보수성을 높이는 것을 권장합니다.
🤖 Prompt for AI Agents