프론트엔드 추가 및 자동매매 로직 개선:
Some checks failed
Build Push and Restart Compose / deploy (push) Failing after 1m42s
Some checks failed
Build Push and Restart Compose / deploy (push) Failing after 1m42s
- Svelte 기반 프론트엔드 프로젝트 초기 설정 추가 (`vite`, `tailwindcss` 등 포함). - "자동매매" 주요 상태 및 규칙 관리 페이지 구현. - 1차/2차 손절 및 익절 조건 평가 로직 추가(`calcStopTargets`, `evalExitReason` 등). - 포지션 상세 로그 및 WebSocket 기반 실시간 로그 스트림 추가. - API 서비스 및 Frontend 간 Proxy 설정(Vite 서버). - 세션 체크를 위한 `CheckSession` 핸들러 추가.
This commit is contained in:
@@ -20,7 +20,12 @@ type AutoTradeRule struct {
|
||||
MaxPositions int `json:"maxPositions"` // 동시 최대 보유 종목 수 (기본 3)
|
||||
|
||||
// 청산 조건
|
||||
StopLossPct float64 `json:"stopLossPct"` // 손절 % (예: -3.0)
|
||||
// 2중 손절 구조:
|
||||
// 1차 - StopLoss1Pct 에 StopLoss1Count 회 터치 시 매도
|
||||
// 2차 - StopLossPct 에 닿으면 즉시 매도 (StopLoss1Count==0 이면 단일 손절)
|
||||
StopLoss1Pct float64 `json:"stopLoss1Pct"` // 1차 손절 % (예: -2.0, 0=비활성)
|
||||
StopLoss1Count int `json:"stopLoss1Count"` // 1차 손절 터치 횟수 (예: 3)
|
||||
StopLossPct float64 `json:"stopLossPct"` // 2차 손절 % (예: -4.0, 즉시 매도)
|
||||
TakeProfitPct float64 `json:"takeProfitPct"` // 익절 % (예: 5.0)
|
||||
MaxHoldMinutes int `json:"maxHoldMinutes"` // 최대 보유 시간(분, 0=무제한)
|
||||
ExitBeforeClose bool `json:"exitBeforeClose"` // 장 마감 전 청산(15:20 기준)
|
||||
@@ -30,15 +35,17 @@ type AutoTradeRule struct {
|
||||
|
||||
// AutoTradePosition 자동매매 포지션
|
||||
type AutoTradePosition struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
BuyPrice int64 `json:"buyPrice"` // 매수 체결가
|
||||
Qty int64 `json:"qty"` // 수량
|
||||
OrderNo string `json:"orderNo"` // 매수 주문번호
|
||||
EntryTime time.Time `json:"entryTime"` // 진입 시각
|
||||
RuleID string `json:"ruleId"` // 규칙 ID
|
||||
StopLoss int64 `json:"stopLoss"` // 절대 손절가
|
||||
TakeProfit int64 `json:"takeProfit"` // 절대 익절가
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
BuyPrice int64 `json:"buyPrice"` // 매수 체결가
|
||||
Qty int64 `json:"qty"` // 수량
|
||||
OrderNo string `json:"orderNo"` // 매수 주문번호
|
||||
EntryTime time.Time `json:"entryTime"` // 진입 시각
|
||||
RuleID string `json:"ruleId"` // 규칙 ID
|
||||
StopLoss1 int64 `json:"stopLoss1"` // 절대 1차 손절가 (0=비활성)
|
||||
StopLoss1Touches int `json:"stopLoss1Touches"` // 1차 손절가 터치 누적 횟수
|
||||
StopLoss int64 `json:"stopLoss"` // 절대 2차 손절가 (즉시 매도)
|
||||
TakeProfit int64 `json:"takeProfit"` // 절대 익절가
|
||||
|
||||
// 상태: "pending"=체결 대기 | "open"=보유중 | "closed"=청산완료
|
||||
Status string `json:"status"`
|
||||
@@ -51,9 +58,9 @@ type AutoTradePosition struct {
|
||||
// AutoTradeLog 자동매매 이벤트 로그
|
||||
type AutoTradeLog struct {
|
||||
At time.Time `json:"at"`
|
||||
Level string `json:"level"` // "info"|"warn"|"error"
|
||||
Level string `json:"level"` // "info"|"warn"|"error"
|
||||
Message string `json:"message"`
|
||||
Code string `json:"code"` // 관련 종목코드 (없으면 "")
|
||||
Code string `json:"code"` // 관련 종목코드 (없으면 "")
|
||||
}
|
||||
|
||||
// ThemeRef 감시 소스로 선택된 테마 참조
|
||||
|
||||
Reference in New Issue
Block a user