#!/bin/bash
set -euo pipefail
cd /home/hoon/kis_bot
mkdir -p logs
TS=$(date +%Y%m%d_%H%M%S)
STUDY="breakout_fine_20260715_${TS}"
LOG="logs/param_search_optuna_breakout_fine_${TS}.log"
echo "$LOG" > logs/param_search_optuna_breakout_fine_latest.logpath
echo "$STUDY" > logs/param_search_optuna_breakout_fine_latest.study
# 120만 한도 정합 (구 study는 env_config 단독→600만 버그). 새 study-name 필수.
nohup python3 -u kis_trader/backtest/param_search_optuna.py \
  --strategy breakout \
  --mode fine \
  --start 2026-07-15 \
  --end 2026-07-15 \
  --trials 200 \
  --min_trades 1 \
  --orderbook-filter off \
  --no-progress \
  --apply-best \
  --study-name "$STUDY" \
  > "$LOG" 2>&1 &
echo "PID=$!"
echo "STUDY=$STUDY"
echo "LOG=$LOG"
echo "tail -f /home/hoon/kis_bot/$LOG"
