3.8 KiB
3.8 KiB
단타 자동매매 시스템 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 | 실거래 ← 조건 충족 후 |
빠른 시작
# 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 | 긴급 청산 | 수동 트리거 |
긴급 청산
docker-compose --profile emergency up kill-switch
# 또는
python kill_switch/kill.py
StockBot Current Status - 2026-05-28
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.
- Approved
ENTRY_START = "09:20"after the 2026-05-28 evening review. FORCE_EXIT = "14:50"remains unchanged.avoid_sectorsfiltering is active in runtime entry checks.- 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.
- External daily collection falls back to KIS when pykrx same-day data fails.
- KIS minute collection excludes ETF/ETN by default and collects multiple windows from 09:30 to 14:00.
- RandomForest-based training engine.
- Optional AI entry scoring when
models/scalping_model.joblibexists. - Latest verified training run: 2026-05-28 20:24.
- Latest training rows: 3,156 total, including 3,146 external pretraining rows and 10 bot-trade rows.
- Latest metrics:
label_stop_lossROC-AUC 0.851,label_winROC-AUC 0.719.
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:
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.txtincludesapp/requirements.txt. scripts/download_dependencies.ps1downloads Windows/Python 3.11 wheels tovendor/wheels.scripts/install_dependencies.ps1installs fromvendor/wheelsfirst, then falls back to online pip.- Raspberry Pi needs its own wheelhouse or online install because Windows wheels are not ARM/Linux compatible.