2026-05-27 16:53:52 +09:00
|
|
|
# Implementation Log
|
|
|
|
|
|
2026-05-28 20:39:37 +09:00
|
|
|
## 2026-05-28
|
|
|
|
|
|
|
|
|
|
- Applied the approved 2026-05-28 strategy update:
|
|
|
|
|
- `ENTRY_START` changed from `"09:15"` to `"09:20"`.
|
|
|
|
|
- `FORCE_EXIT = "14:50"` was verified unchanged.
|
|
|
|
|
- Fixed the `avoid_sectors` runtime bug:
|
|
|
|
|
- `app/main.py` now passes `sector` into `VolatilityBreakout.check_entry()`.
|
|
|
|
|
- Added `ticker_sectors` cache support from ranking rows when sector fields exist.
|
|
|
|
|
- Added conservative name-based avoid-sector hints for cases such as construction names when no sector field is available.
|
|
|
|
|
- Repaired the external-data pretraining path:
|
|
|
|
|
- `scripts/collect_daily_features.py` now falls back to KIS daily OHLCV when pykrx fails.
|
|
|
|
|
- `scripts/collect_minute_data.py` excludes ETF/ETN by default and collects multiple intraday windows from 09:30 to 14:00.
|
|
|
|
|
- `scripts/build_external_training_dataset.py` now uses prior daily OHLCV rows for breakout targets instead of same-day OHLCV.
|
|
|
|
|
- `scripts/run_training_pipeline.ps1` builds external rows with `--all-minutes` for pretraining.
|
|
|
|
|
- Removed model leakage:
|
|
|
|
|
- Excluded future/outcome columns from training features: `price_*`, `ret_*`, `mfe_*`, `mae_*`, `pnl`, and `exit_price`.
|
|
|
|
|
- Fixed PowerShell training pipeline execution:
|
|
|
|
|
- Replaced `$Args` parameter usage with `$StepArgs` to avoid PowerShell automatic-variable collision.
|
|
|
|
|
- Prevented nonzero stderr output from stopping required exit-code handling.
|
|
|
|
|
- Normalized Python step logging to UTF-8 append.
|
|
|
|
|
- Removed unused helper:
|
|
|
|
|
- `scripts/_send_midday_discord.py`.
|
|
|
|
|
|
|
|
|
|
Validation performed:
|
|
|
|
|
- `python -m compileall app scripts` passed.
|
|
|
|
|
- Manual external daily collection passed through KIS fallback.
|
|
|
|
|
- Manual KIS minute collection saved 11 regular-stock CSV files for 2026-05-28.
|
|
|
|
|
- `data/external_training_dataset.csv` generated 3,146 rows.
|
|
|
|
|
- `data/training_dataset.csv` generated 10 bot-trade rows.
|
|
|
|
|
- `python scripts/train_ai_model.py` generated `models/scalping_model.joblib` and metrics.
|
|
|
|
|
- `powershell -ExecutionPolicy Bypass -File scripts\run_training_pipeline.ps1` passed end-to-end.
|
|
|
|
|
|
|
|
|
|
Latest training metrics:
|
|
|
|
|
- `label_stop_loss`: rows 3,156, accuracy 0.750, precision 0.450, ROC-AUC 0.851.
|
|
|
|
|
- `label_win`: rows 3,156, accuracy 0.635, precision 0.492, ROC-AUC 0.719.
|
|
|
|
|
|
|
|
|
|
Open risks:
|
|
|
|
|
- AI remains observation-only and must not block entries, resize trades, or override exits.
|
|
|
|
|
- Training is still dominated by external pretraining rows; actual bot-labeled rows are only 10.
|
|
|
|
|
- Same-day pykrx data may fail; KIS fallback is active but index rows can be empty.
|
|
|
|
|
- Real-cash trading remains unapproved.
|
|
|
|
|
|
2026-05-27 16:53:52 +09:00
|
|
|
## 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"`.
|