#!/bin/bash
set -euo pipefail
cd /home/hoon/kis_bot
mkdir -p logs
TS=$(date +%Y%m%d_%H%M%S)
# wide 격자 v2(확장) — categorical 변경이라 구 study 재사용 금지
STUDY="tail_wide2_20260715_${TS}"
LOG="logs/param_search_optuna_tail_wide2_${TS}.log"
echo "$LOG" > logs/param_search_optuna_tail_wide2_latest.logpath
echo "$STUDY" > logs/param_search_optuna_tail_wide2_latest.study
nohup python3 -u kis_trader/backtest/param_search_optuna.py \
  --strategy tail \
  --mode wide \
  --start 2026-07-15 \
  --end 2026-07-15 \
  --trials 100 \
  --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"
