Commit Graph

215 Commits

Author SHA1 Message Date
dc9bc114da refactor: 프론트엔드 TypeScript 타입 안전성 및 커스텀 훅 분리
- types/trading.ts: 중앙 타입 정의 (CandleData, Position, Trade 등)
- useMarketData.ts: 실시간 시세 처리 + 500ms 쓰로틀링
- usePortfolioData.ts: React Query 기반 포트폴리오 데이터 훅
- useTradeActions.ts: 매매 실행 액션 훅
- useWebSocket.ts: pong timeout 10초 감지 (좀비 연결 방지)
- TradingChart.tsx: @ts-nocheck 제거, CandleData 타입 적용
- PortfolioPanel/RecommendationPanel: any → 구체적 타입 교체
- Dashboard.tsx: 상태 관리 로직을 커스텀 훅으로 이전

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 17:26:27 +09:00
a477072bdc feat: 리스크 관리 강화 — 포트폴리오 락, MDD 단기전략 비활성화, 상관관계 필터
- portfolio.py: summary_lock으로 동시성 보호, apply_buy/apply_sell async화
- mdd_manager.py: MDD -10% 시 단기전략 비활성화 (is_short_term_strategy_paused)
- loss_tracker.py: DB 직접 접근 → db_worker 큐 기반 전환
- db_worker.py: upsert_stock_ban 태스크 추가
- correlation_filter.py: 섹터 집중도 + 피어슨 상관관계 검증 (CLAUDE.md 5.4)
- trade_executor.py: 상관관계 필터 통합, await 적용
- mean_reversion_strategy.py: config 값 타입 안전성 (float 변환)
- main.py/day_trading.py: MDD 체크 후 자동매매/데이트레이딩 차단

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 17:26:13 +09:00
783e932145 Merge pull request #7 from YoungWooSeo/claude/fix-trading-bugs
fix: 자동매매 미작동 근본 원인 4개 수정
2026-03-10 13:25:26 +09:00
3eb38690fe fix: 자동매매 미작동 근본 원인 4개 수정
## 버그 수정 요약

### 1. 거래량 필터 오작동 (market_analyzer.py)
- acml_vol(당일 누적량, 장초 2~10만주)을 100만주 기준으로 필터
  → 전 종목이 필터에 걸려 추천 종목 0개
- 수정: 20일 평균 거래량(avg_vol_20) 기준 10만주 미만 필터로 교체

### 2. min_volume_ratio 기본값 1.0 미설정 (recommendations.py)
- get_rule_based_recommendations_realtime()에서 min_volume_ratio 누락
  → 기본값 1.0 적용, 장중 acml_vol/avg_vol_20≈0.1 → 전 종목 None 반환
- 수정: min_volume_ratio=0 명시 설정

### 3. KRX 호가단위 오류 (korea_investment_api.py)
- 계산된 주문가격이 호가단위(50/100/500/1000원 등) 불일치
  → 모의투자 "호가단위 오류"로 모든 주문 실패
- 수정: _round_to_krx_tick() 헬퍼 추가, 주문 전 올림 처리

### 4. MCP 서버 AI_PROVIDER 미전달 (docker-compose.dev.yml, mcp-server/config.py)
- mcp-server 서비스에 AI_PROVIDER 환경변수 누락 → 항상 Gemini 사용
- Gemini 무료 쿼터 소진 → /analyze 500 에러 → fail-open
- 수정: AI_PROVIDER=${AI_PROVIDER:-claude} 추가
- 수정: load_dotenv(override=True)로 빈 env var 덮어쓰기 허용

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 13:24:11 +09:00
096e087a9a 코드 변경 2026-03-10 09:49:03 +09:00
a15ecaa314 Merge pull request #6 from YoungWooSeo/claude/naughty-carson
feat: 매매일지 자동 생성 + 전략 자동 최적화 시스템 추가
2026-03-10 09:45:03 +09:00
3a08cd8609 chore: update local settings permissions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 09:38:04 +09:00
2baf06a5fd feat: 매매일지 자동 생성 + 전략 자동 최적화 시스템 추가
- trade_analyzer.py: 거래 성과 분석(승률/손익비/전략별 패턴), 템플릿 기반 일지 자동 생성
- strategy_optimizer.py: 그리드 서치 기반 파라미터 최적화, Sharpe 10% 개선 시 자동 적용
- analysis.py: /performance /insights /generate-journals /optimize-strategy /optimization-history 엔드포인트
- journals.py: POST /generate/{trade_id}, GET /stats 엔드포인트 추가
- models.py: StrategyOptimizationLog 테이블 추가
- main.py: post_market_analyzer_scheduler (16:00 KST 자동 실행)
- frontend: Analysis 페이지 추가 (성과 요약/인사이트/일지 생성/최적화 이력)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 09:28:10 +09:00
f42e94fe6c refactor: 전략 설정 화면 UI 간소화 및 개선
- 프리셋 카드 UI 개선 (3종 → 명확한 비교 표시)
- 필수 설정 6개만 상단 배치
- 중복 파라미터 통합 (RSI 2개 → 1개, 손절 3개 → 1개)
- 그룹별 접기/펼치기 기본값 변경
- 툴팁 및 가이드 추가
2026-03-07 13:35:13 +09:00
7c9b596098 백테스트 수정중 2026-03-07 13:16:01 +09:00
ea355eb60c fix: Update universe presets usage for new API structure 2026-03-06 22:33:19 +09:00
5f84897aa6 fix: Remove Stock model dependency, use StockDailyPrice only 2026-03-06 22:22:33 +09:00
83cf8330b5 fix: Fix group section accordion not working 2026-03-06 22:17:24 +09:00
4473bca7ca fix: Remove unused BacktestResult type 2026-03-06 22:11:20 +09:00
19711705b3 feat: Add bulk universe backtest UI tab 2026-03-06 21:57:15 +09:00
87b4205fb6 feat: Add bulk backtest endpoints for entire stock universe 2026-03-06 21:55:45 +09:00
da4732f1e9 feat: Add stock universe loader for bulk backtest 2026-03-06 21:53:59 +09:00
0c4c888b38 feat: Add Backtest to navigation 2026-03-06 21:29:07 +09:00
3c14be1d97 feat: Add Backtest route to App 2026-03-06 21:28:40 +09:00
38ba5bfbb0 feat: Add backtest UI with ML training data generation and strategy testing 2026-03-06 21:28:16 +09:00
7a31651cc5 feat: Register backtest router in API 2026-03-06 21:27:13 +09:00
d54785f79d feat: Add backtest API endpoints for ML training and strategy testing 2026-03-06 21:26:56 +09:00
943708e68e feat: Add comprehensive backtest engine with ML training data generation 2026-03-06 21:25:49 +09:00
ab6fe810bd feat: Add preset selector and improved UI with collapsible groups 2026-03-06 20:49:05 +09:00
674cb1ef28 feat: Add strategy presets for quick configuration 2026-03-06 20:47:19 +09:00
12460b7c9e 매매전략 수정중 2026-03-06 20:46:08 +09:00
2b9a90a03f 소스리뷰 버전 적용 2026-03-06 19:10:39 +09:00
ab75dc66f8 코드리뷰 수정 2026-03-06 15:22:40 +09:00
da5cef1925 MCP 수정중 2026-03-06 14:40:31 +09:00
ac98bb856f 배치 수정 2026-03-06 14:12:54 +09:00
6d39069d3f merge: phase3 realtime module refactor into main
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 11:05:39 +09:00
eef9620aa6 merge: phase2 strategy module refactor into main
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 11:05:37 +09:00
d341e7e3cc merge: phase1 trading module refactor into main
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 11:05:35 +09:00
48aa5440ec refactor(phase3): Add realtime module examples and README 2026-03-06 11:00:03 +09:00
b1eab5305a refactor(phase3): Add KIS WebSocket client implementation 2026-03-06 10:58:28 +09:00
7355df6ebf refactor(phase3): Create realtime module core structure 2026-03-06 10:57:40 +09:00
a322745cf3 refactor(phase2): Add Scanner module and strategy README 2026-03-06 10:55:19 +09:00
8920699eee refactor(phase2): Add DayTradingStrategy example and indicators module 2026-03-06 10:53:48 +09:00
025ecb5f4f refactor(phase2): Add StrategyManager for strategy orchestration 2026-03-06 10:52:40 +09:00
70dd32a783 refactor(phase2): Create strategy module core structure 2026-03-06 10:51:58 +09:00
30babd2963 docs(phase1): Add trading module documentation 2026-03-06 10:47:00 +09:00
a7eb07b860 refactor(phase1): Update trading module exports 2026-03-06 10:46:07 +09:00
3baafd56e8 refactor(phase1): Add backward compatibility adapter 2026-03-06 10:45:51 +09:00
ea4ebae992 refactor(phase1): Add market data module for price/chart queries 2026-03-06 10:45:21 +09:00
0bfca909cc refactor(phase1): Create trading module core files 2026-03-06 10:44:33 +09:00
0774352a98 refactor: Create trading module structure 2026-03-06 10:29:59 +09:00
ef324c42db docs: Add comprehensive refactoring plan 2026-03-06 10:29:31 +09:00
c93b35ba04 추천로직 2026-03-06 10:01:13 +09:00
d6841a06f7 배치 실계좌에서 종목조회로 변경 2026-03-03 13:34:31 +09:00
0531952edb feat: lifespan에 strategy_cfg.auto_init() 추가 2026-03-03 10:44:49 +09:00