63 lines
1.8 KiB
Java
63 lines
1.8 KiB
Java
package com.goldenchart.dto;
|
|
|
|
import lombok.*;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 백테스팅 결과 응답 DTO.
|
|
*
|
|
* <pre>
|
|
* {
|
|
* "signals": [
|
|
* { "time": 1700000000, "type": "BUY", "price": 42000 },
|
|
* { "time": 1700200000, "type": "SELL", "price": 45000 }
|
|
* ],
|
|
* "stats": { "totalTrades": 8, "winRate": 0.625, ... }
|
|
* }
|
|
* </pre>
|
|
*/
|
|
@Data @Builder @NoArgsConstructor @AllArgsConstructor
|
|
public class BacktestResponse {
|
|
|
|
private List<Signal> signals;
|
|
private Stats stats;
|
|
/** Ta4j AnalysisCriterion 전체 결과 */
|
|
private BacktestAnalysisDto analysis;
|
|
/** DB 저장 후 부여된 결과 ID */
|
|
private Long resultId;
|
|
|
|
@Data @Builder @NoArgsConstructor @AllArgsConstructor
|
|
public static class Signal {
|
|
/** Unix timestamp (초) */
|
|
private long time;
|
|
/** BUY | SELL */
|
|
private String type;
|
|
/** 해당 봉 종가 */
|
|
private double price;
|
|
/** 진입/청산 인덱스 (0-based) */
|
|
private int barIndex;
|
|
}
|
|
|
|
@Data @Builder @NoArgsConstructor @AllArgsConstructor
|
|
public static class Stats {
|
|
private int totalSignals;
|
|
private int buySignals;
|
|
private int sellSignals;
|
|
/** 거래 쌍(매수→매도) 수 */
|
|
private int totalTrades;
|
|
/** 수익 거래 수 */
|
|
private int winTrades;
|
|
/** 승률 0~1 */
|
|
private double winRate;
|
|
/** 총 수익률 (소수, e.g. 0.15 = +15%) */
|
|
private double totalReturn;
|
|
/** 최대 낙폭 (소수, 음수, e.g. -0.12 = -12%) */
|
|
private double maxDrawdown;
|
|
/** 평균 수익률 per trade */
|
|
private double avgReturn;
|
|
/** 최종 자산 (초기 자본 × 복리 수익) */
|
|
private double finalEquity;
|
|
}
|
|
}
|