47 lines
1.3 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# run_focus.sh — focused grid with coverage and confidence sweep
set -euo pipefail
PROJ_DIR="${PROJ_DIR:-$HOME/Documents/Work/TCP/BTC_ETH_regime_predictor}"
DATA_DIR="${DATA_DIR:-$PROJ_DIR/../data}"
PY="${PY:-$PROJ_DIR/.venv/bin/python}"
BTC="$DATA_DIR/btcusd_1-min_data.csv"
ETH="$DATA_DIR/ethusd_1min_ohlc.csv"
SPLIT="2023-01-01"
N_STATES=3
BARS_AHEAD=2 # fixed
CONF_LIST=(0.45 0.50 0.55 0.60)
# Rule bands 3741min and 4959min
readarray -t RULES < <(seq 37 41 | awk '{printf "%dmin\n",$1}')
readarray -t RULES2 < <(seq 49 59 | awk '{printf "%dmin\n",$1}')
RULES=("${RULES[@]}" "${RULES2[@]}")
to_minutes() { echo "${1%min}"; }
OUT_DIR="$PROJ_DIR/run_logs"
mkdir -p "$OUT_DIR"
LOG="$OUT_DIR/focus_$(date +%Y%m%d_%H%M%S).log"
for CONF in "${CONF_LIST[@]}"; do
echo "### Confidence=$CONF" | tee -a "$LOG"
for RULE in "${RULES[@]}"; do
BAR_MIN=$(to_minutes "$RULE")
HORIZON=$((BARS_AHEAD * BAR_MIN))
echo "Running rule='$RULE' horizon_min=$HORIZON conf=$CONF" | tee -a "$LOG"
"$PY" "$PROJ_DIR/main_conf_metrics.py" \
--btc "$BTC" \
--eth "$ETH" \
--rules "$RULE" \
--states "$N_STATES" \
--split "$SPLIT" \
--horizon "$HORIZON" \
--conf "$CONF" | tee -a "$LOG"
echo | tee -a "$LOG"
done
done