2026-05-14 15:14:50 +09:00
|
|
|
# 단타 자동매매 시스템 v3.0
|
|
|
|
|
|
|
|
|
|
기획서 v3.0 기준 / KIS Open API / Synology NAS Docker
|
|
|
|
|
AI: Claude Code headless (장 전 분석 + 장 후 피드백)
|
|
|
|
|
|
|
|
|
|
## 운영 모드
|
|
|
|
|
|
|
|
|
|
| KIS_MOCK | DRY_RUN | 동작 |
|
|
|
|
|
|----------|---------|------|
|
|
|
|
|
| true | true | 신호 확인만 (주문 없음) ← 처음 시작 |
|
|
|
|
|
| true | false | 모의투자 실제 주문 ← 3개월 검증 |
|
|
|
|
|
| false | false | 실거래 ← 조건 충족 후 |
|
|
|
|
|
|
|
|
|
|
## 빠른 시작
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# 1. .env 설정
|
|
|
|
|
cp .env.example .env
|
|
|
|
|
# .env 열어서 KIS 키, Discord Webhook URL 입력
|
|
|
|
|
|
|
|
|
|
# 2. KIS 연결 테스트
|
|
|
|
|
pip install aiohttp python-dotenv
|
|
|
|
|
python test_connection.py
|
|
|
|
|
|
|
|
|
|
# 3. 신호 확인 (DRY_RUN=true)
|
|
|
|
|
python app/main.py
|
|
|
|
|
|
|
|
|
|
# 4. Docker 실행 (NAS)
|
|
|
|
|
docker-compose up -d
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 컨테이너 구성
|
|
|
|
|
|
|
|
|
|
| 컨테이너 | 역할 | 실행 시간 |
|
|
|
|
|
|---------|------|---------|
|
|
|
|
|
| stockbot-main | 매매 프로그램 | 상시 (09:00~15:00 활성) |
|
|
|
|
|
| stockbot-redis | 시세 캐시 | 상시 |
|
|
|
|
|
| stockbot-dashboard | Streamlit 모니터링 | 상시 (포트 8501) |
|
|
|
|
|
| claude-morning | 장 전 AI 분석 | 08:30 (실행 후 종료) |
|
|
|
|
|
| claude-evening | 장 후 AI 피드백 | 15:30 (실행 후 종료) |
|
|
|
|
|
| stockbot-killswitch | 긴급 청산 | 수동 트리거 |
|
|
|
|
|
|
|
|
|
|
## 긴급 청산
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
docker-compose --profile emergency up kill-switch
|
|
|
|
|
# 또는
|
|
|
|
|
python kill_switch/kill.py
|
|
|
|
|
```
|
2026-05-27 16:53:52 +09:00
|
|
|
# StockBot Current Status - 2026-05-27
|
|
|
|
|
|
|
|
|
|
This project is currently a paper-trading scalping bot with an AI training
|
|
|
|
|
pipeline in observation mode.
|
|
|
|
|
|
|
|
|
|
Active:
|
|
|
|
|
- Windows Task Scheduler operation for morning, midday, evening, watchdog, and training jobs.
|
|
|
|
|
- Entry snapshots for model training.
|
|
|
|
|
- Post-entry snapshots at 1m, 3m, 5m, and 10m.
|
|
|
|
|
- Bot-data export to `data/training_dataset.csv`.
|
|
|
|
|
- External daily/minute data collection for pretraining.
|
|
|
|
|
- RandomForest-based training engine.
|
|
|
|
|
- Optional AI entry scoring when `models/scalping_model.joblib` exists.
|
|
|
|
|
|
|
|
|
|
Not active yet:
|
|
|
|
|
- AI does not block buys.
|
|
|
|
|
- AI does not change position size.
|
|
|
|
|
- AI does not override exits.
|
|
|
|
|
- Real-cash trading is not ready until fill, unfilled-order, and partial-fill handling is hardened.
|
|
|
|
|
|
|
|
|
|
Daily schedule:
|
|
|
|
|
|
|
|
|
|
| Time | Task | Purpose |
|
|
|
|
|
|---|---|---|
|
|
|
|
|
| 08:15 | `StockBot_Morning` | Run `/morning`, build context, start bot |
|
|
|
|
|
| 09:00-15:10 | `StockBot_Watchdog` | Check/restart bot every 5 minutes |
|
|
|
|
|
| 11:20 | `StockBot_Midday` | Midday review and context update |
|
|
|
|
|
| 15:30 | `StockBot_Evening` | Daily review and proposal report |
|
|
|
|
|
| 16:00 | `StockBot_Training` | Collect data, export datasets, train model |
|
|
|
|
|
|
|
|
|
|
Useful commands:
|
|
|
|
|
|
|
|
|
|
```powershell
|
|
|
|
|
python -m pip install -r requirements.txt
|
|
|
|
|
powershell -ExecutionPolicy Bypass -File scripts\install_dependencies.ps1
|
|
|
|
|
powershell -ExecutionPolicy Bypass -File scripts\setup_scheduler.ps1
|
|
|
|
|
powershell -ExecutionPolicy Bypass -File scripts\run_training_pipeline.ps1
|
|
|
|
|
python scripts\export_training_dataset.py
|
|
|
|
|
python scripts\train_ai_model.py
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Dependency portability:
|
|
|
|
|
- Root `requirements.txt` includes `app/requirements.txt`.
|
|
|
|
|
- `scripts/download_dependencies.ps1` downloads Windows/Python 3.11 wheels to `vendor/wheels`.
|
|
|
|
|
- `scripts/install_dependencies.ps1` installs from `vendor/wheels` first, then falls back to online pip.
|
|
|
|
|
- Raspberry Pi needs its own wheelhouse or online install because Windows wheels are not ARM/Linux compatible.
|
|
|
|
|
|
|
|
|
|
---
|