#!/bin/bash
set -euo pipefail
cd /home/hoon/kis_bot
mkdir -p logs
TS=$(date +%Y%m%d_%H%M%S)
STUDY="tail_fine_wide1Tune_20260715_${TS}"
LOG="logs/param_search_optuna_tail_fine_${TS}.log"
echo "$LOG" > logs/param_search_optuna_tail_fine_latest.logpath
echo "$STUDY" > logs/param_search_optuna_tail_fine_latest.study
# wide1 분지 fine — apply 없음. 격자 변경 → 새 study-name.
nohup python3 -u kis_trader/backtest/param_search_optuna.py \
  --strategy tail \
  --mode fine \
  --start 2026-07-15 \
  --end 2026-07-15 \
  --trials 200 \
  --min_trades 1 \
  --orderbook-filter off \
  --no-progress \
  --study-name "$STUDY" \
  > "$LOG" 2>&1 &
echo "PID=$!"
echo "STUDY=$STUDY"
echo "LOG=$LOG"
echo "tail -f /home/hoon/kis_bot/$LOG"
