[2026-05-27] 포맷 후 복구 설치 스크립트 추가

This commit is contained in:
2026-05-27 16:53:52 +09:00
parent 04577c63f1
commit 29db1bfcab
135 changed files with 2909 additions and 251 deletions
+64
View File
@@ -0,0 +1,64 @@
# [2026-05-15] 일일 리포트
## 매매 결과
- 총 신호: 10건 (SL 청산 3건, 미청산 7건)
- 완결 매매: 0회 (DRY_RUN=true, 실주문 없음)
- 순손익: 0원 (모의투자 신호 테스트 단계)
- 모드: 모의투자 (KIS_MOCK=true, DRY_RUN=true)
## 신호 상세
| 종목 | 진입시간 | 청산시간 | 사유 | 가격 |
|------|----------|----------|------|------|
| 412570 | 09:09:54 | - | 미청산 | 0 (미수집) |
| 462330 | 09:09:58 | - | 미청산 | 0 |
| 462330 | 09:12:55 | - | 미청산 | 0 |
| 138360 | 09:13:13 | - | 미청산 | 0 |
| 090710 | 10:03:19 | - | 미청산 | 0 |
| 018880 | 10:03:25 | - | 미청산 | 0 |
| **018880** | 10:17:16 | 10:29:59 | **SL** | 0 |
| **036540** | 10:17:26 | 10:28:34 | **SL** | 0 |
| **090710** | 10:28:44 | 10:32:27 | **SL** | 0 |
| 252670 | 10:30:19 | - | 미청산 | 0 |
## 분석 및 피드백
### 데이터 품질 문제 (우선 해결 필요)
- **entry_price / exit_price 모두 0.0**: DB에 가격 데이터가 저장되지 않는 버그
- DRY_RUN=true 상태에서 주문 체결 시 가격을 기록하지 않는 것으로 추정
- pnl 계산 불가 → 전략 평가 전혀 불가
- **daily_summary 테이블 미기록**: 봇 결산 로직이 DB에 저장하지 않음
### 봇 중복 실행 문제
- 14:54:14 ~ 14:55:24 사이에 봇이 3번 재시작됨
- 14:50 강제청산 이후 재시작으로 추정되나 원인 불명확
- `/start-bot` 중복 방지 로직이 종료된 프로세스를 감지하지 못한 것으로 보임
### SL 패턴 관찰
- 10:17~10:32 시간대에 SL 3건이 집중 (약 15분 내)
- 3연속 손절 패턴 → L3 조건에 해당하나, DRY_RUN이라 실제 매매 중단은 없음
- 10:30에도 새 진입 신호 발생 (252670) → L3 중단 로직 점검 필요
### 긍정적 사항
- 변동성 돌파 신호 자체는 감지됨 (09:09~10:30에 10건)
- 손절 청산 로직이 작동함 (exit_reason='SL' 기록)
- 강제청산(14:50) 이후 신호 없음 → 시간 제한 작동 확인
## 파라미터 변경
없음 — 가격 데이터가 모두 0이라 SL/TP 효과 평가 불가. 데이터 품질 문제 해결 후 재평가 필요.
## 실전 전환 조건
| 조건 | 기준 | 현재 | 통과 |
|------|------|------|------|
| 누적 운영 | 30거래일 이상 | 0일 | ❌ |
| 승률 | > 48% | 데이터 없음 | ❌ |
| MDD | < -10% | 데이터 없음 | ❌ |
| 샤프지수 | > 1.0 | 데이터 없음 | ❌ |
| L3 발동 | 월 2회 이하 | 0회 | ✅ |
**실전 전환: 미충족 (4/5 조건 데이터 부족)**
## 다음 우선순위
1. **DB 가격 데이터 저장 버그 수정** — entry_price/exit_price가 0으로 저장되는 원인 확인
2. **daily_summary 자동 기록** — 결산 시 DB에 저장하는 로직 점검
3. **L3 중단 후 재진입 차단** — SL 3연속 이후에도 새 진입 신호가 발생한 점 확인
+10
View File
@@ -115,3 +115,13 @@
- 14:50 강제청산 정상 작동 확인
- 신호진단 로그 정상 작동 확인
- 장 종료 후 미청산 포지션 없음
- Applied `ENTRY_START = "09:15"` in `app/config.py`.
- Reason: 09:05-09:06 produced four immediate SL trades and about 74.5% of today's loss.
- Deferred: time-based position-size reduction and time-based SL changes. These need more data.
### Strategy Change Log
- User approved the change after reviewing Claude Evening feedback.
- Applied `ENTRY_START = "09:15"`.
- Verified by importing `ENTRY_START` from `app.config`.
- Expected next validation: next trading day after 08:15 scheduled restart.
+80
View File
@@ -0,0 +1,80 @@
# Implementation Log
## 2026-05-27
- Reviewed the stock scalping bot structure and moved it toward an AI-training-ready paper-trading platform.
- Added database tables for AI training:
- `entry_snapshots`
- `post_entry_snapshots`
- Added entry-time data capture after successful buys.
- Added post-entry sampling at 60s, 180s, 300s, and 600s.
- Fixed partial-exit accounting so partial TP1 exits no longer close the whole trade row.
- Relaxed strict entry-limit enforcement during paper-trading data collection while preserving warning logs.
- Added daily/export training scripts:
- `scripts/export_training_dataset.py`
- `scripts/collect_daily_features.py`
- `scripts/collect_minute_data.py`
- `scripts/build_external_training_dataset.py`
- Added ML training and runtime support:
- `app/ml/features.py`
- `app/ml/predictor.py`
- `scripts/train_ai_model.py`
- Added observation-only AI scoring:
- Runtime scores are recorded only when a trained model exists.
- AI scores do not block entries, change sizing, or override exits.
- Added daily training pipeline:
- `scripts/run_training_pipeline.ps1`
- Registered and verified Windows Scheduler tasks:
- `StockBot_Morning`
- `StockBot_Watchdog`
- `StockBot_Midday`
- `StockBot_Evening`
- `StockBot_Training`
- Rewrote scheduler setup to avoid hardcoded broken Korean paths:
- `scripts/setup_scheduler.ps1`
- Rewrote watchdog wrapper with trading-day and time-window checks:
- `scripts/run_watchdog.ps1`
- Added dependency portability:
- Root `requirements.txt`
- `scripts/install_dependencies.ps1`
- `scripts/download_dependencies.ps1`
- `vendor/wheels` wheelhouse for Windows/Python 3.11
- Updated operational docs:
- `README.md`
- `CLAUDE.md`
- `reports/daily/2026-05-27.md`
Validation performed:
- Python compile check passed.
- DB migration checked.
- AI score snapshot insert checked with a temporary DB.
- Training script checked with empty dataset.
- Scheduler registration checked.
- PowerShell script parse check passed.
Open risks:
- KIS minute endpoint still needs live response verification.
- Early model quality is expected to be weak until enough labeled rows exist.
- External minute data is useful for pretraining, not final bot-trade truth.
- Real-cash trading still needs stronger fill, partial-fill, unfilled-order, cancel/replace, and recovery handling.
- Raspberry Pi dependency packaging needs a Linux/ARM-specific setup.
- Approved and applied `ENTRY_START = "09:15"` after the 2026-05-27 evening review.
- Reason: 09:05-09:06 generated four immediate SL trades and most of the daily loss.
- Time-based sizing and time-based SL changes remain deferred.
### 2026-05-27 Strategy Approval Log
- User approved Claude Evening Proposal 1.
- Changed `app/config.py`:
- Before: `ENTRY_START = "09:05"`
- After: `ENTRY_START = "09:15"`
- Rationale:
- Four immediate SL trades occurred from 09:05:03 to 09:05:49.
- Those four trades lost about `-183,969 KRW`.
- This represented about 74.5% of the daily loss.
- Deferred:
- Time-based position-size reduction.
- Time-based stop-loss adjustment.
- Verification:
- Python compile check passed.
- Runtime import confirmed `ENTRY_START == "09:15"`.
+1
View File
@@ -0,0 +1 @@
@@ -101,3 +101,10 @@ SL_PCT = 0.020
- [ ] 과거 5/19~5/22 기간 09:05~09:15 진입 건 별도 확인 (DB 직접 조회)
- [ ] ENTRY_START 변경 시 morning 분석의 종목 선정 로직과 충돌 없는지 확인
- [ ] 변경 적용 후 최소 5거래일 관찰 후 효과 재검토
# Manual Approval Update - 2026-05-27
- Proposal 1 approved and applied.
- `ENTRY_START` changed from `"09:05"` to `"09:15"` in `app/config.py`.
- Proposal 2 and Proposal 3 remain deferred until more data is collected.
---