Files
kis_bot/scripts/run_tail_backtest_job.sh
2026-07-30 18:05:07 +09:00

35 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# 꼬리 백테 CLI 잡 — nohup 래퍼 (웹 타임아웃 회피)
# 사용:
# ./scripts/run_tail_backtest_job.sh 2026-07-20 2026-07-22
# ./scripts/run_tail_backtest_job.sh 2026-07-22 2026-07-22 --params-json /path/params.json
# ./scripts/run_tail_backtest_job.sh 2026-07-22 2026-07-22 --tick-db 0 --tick-exit 0
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
START="${1:-}"
END="${2:-}"
if [[ -z "$START" || -z "$END" ]]; then
echo "usage: $0 START END [extra args...]" >&2
exit 2
fi
shift 2
TS="$(date +%Y%m%d_%H%M%S)"
JOB="tail_bt_cli_${START//-/}_${END//-/}_${TS}"
LOG_DIR="$ROOT/logs"
mkdir -p "$LOG_DIR" "$ROOT/kis_trader/backtest/results"
LOG="$LOG_DIR/${JOB}.log"
PY="${ROOT}/.venv/bin/python"
if [[ ! -x "$PY" ]]; then
PY="python3"
fi
nohup "$PY" -u "$ROOT/scripts/run_tail_backtest_cli.py" \
--start "$START" --end "$END" \
--job-id "$JOB" \
--out-dir "$ROOT/kis_trader/backtest/results" \
"$@" \
>"$LOG" 2>&1 &
echo "pid=$!"
echo "log=$LOG"
echo "tail -f $LOG"