#!/bin/bash # Evening review - runs after market close. TODAY=$(date '+%Y-%m-%d') claude --bare -p " Analyze today's StockBot trading result for $TODAY. Hard rule: - Do not edit app/config.py or any execution, strategy, risk, or order code. - If a parameter change looks necessary, write it as a proposal only. - FORCE_EXIT must remain 14:50. Data to inspect: 1. SQLite: SELECT * FROM trades WHERE date='$TODAY'; SELECT * FROM daily_summary WHERE date='$TODAY'; 2. logs/stockbot.log for today's runtime errors and entry diagnostics. 3. Recent reports under reports/daily/. Review focus: - Total trades, win rate, net PnL, fees. - Exit reason distribution: TP1 / TP2 / SL / TIME / FORCE. - Overtrading signals: * daily entries near or above MAX_DAILY_ENTRIES * repeated stop losses * many TIME or FORCE exits - AI filter quality: * boosted tickers performance * blacklisted or avoided sectors - Execution quality: * missing prices * abnormal zero-price rows * duplicated or inconsistent position/trade rows Write outputs: 1. reports/daily/${TODAY}.md - result summary - exit reason distribution - overtrading assessment - execution or logging issues - next-day watch items 2. reports/proposals/${TODAY}_strategy_proposal.md only if changes are justified. Include: - exact proposed config value - evidence from at least 30 closed trades, or clearly state sample size is insufficient - expected benefit - risk of the change Live readiness check: - at least 30 closed trades - recent win rate > 48% - recent MDD better than -10% - Sharpe > 1.0 - stop/kill risk events <= 2 If all pass, write reports/live_ready/${TODAY}_READY.md. Discord: Send a concise summary to DISCORD_WEBHOOK_URL: [일일결산] $TODAY | trades=N | win=X% | pnl=+X | exits=TP1:n/TP2:n/SL:n/TIME:n/FORCE:n If a proposal file was created, include: [전략제안] proposal saved, manual approval required. " \ --allowedTools "Read,Write,Bash" \ --dangerously-skip-permissions \ --max-turns 20