#!/bin/bash
# [2026-10-24] user: last 2 years with the v3 scanner's picks vs the others. v3 flow download (restarted after the close if market
# hours stop it) -> sim v3 (premarket top 30) -> library sim on the same dates (tick flow, to 2026-10-02)
cd /var/www/screener/trade/reports/ev3
until grep -q "STAR_FLOW_DONE" v3_flow.log 2>/dev/null; do
  H=$(TZ=America/New_York date +%H%M); D=$(TZ=America/New_York date +%u)
  if [ "$D" -le 5 ] && [ "$H" -ge 0910 ] && [ "$H" -lt 1605 ]; then sleep 300; continue; fi
  nice -n 19 python3 star_flow.py lists_v3 >> v3_flow.log 2>&1
  sleep 60
done
nice -n 19 python3 sim_full.py --src v3 --out simv3_2y > simv3_2y.log 2>&1
nice -n 19 python3 sim_full.py --src lib --flow tick --end 2026-10-02 --out simlib_2y_tick_cut > simlib_2y_tick_cut.log 2>&1
echo "V3_QUEUE_DONE" >> v3_flow.log
