39 lines
931 B
Bash
Executable File
39 lines
931 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT="$(git rev-parse --show-toplevel)"
|
|
cd "$ROOT"
|
|
|
|
SNAPSHOT="${1:-backtest_snapshots/fundamentals-backtest.sqlite}"
|
|
WORKERS="${WORKERS:-$(sysctl -n hw.logicalcpu 2>/dev/null || echo 8)}"
|
|
if [[ "$WORKERS" -gt 1 ]]; then
|
|
WORKERS=$((WORKERS - 1))
|
|
fi
|
|
|
|
if [[ -x .venv/bin/python ]]; then
|
|
PYTHON=.venv/bin/python
|
|
else
|
|
PYTHON="${PYTHON:-python3}"
|
|
fi
|
|
|
|
if [[ ! -f "$SNAPSHOT" ]]; then
|
|
echo "Snapshot not found: $SNAPSHOT" >&2
|
|
exit 1
|
|
fi
|
|
|
|
STAMP="$(date -u +%Y%m%d-%H%M%S)"
|
|
OUT="reports/fundamentals-overlay-${STAMP}.json"
|
|
|
|
echo "Snapshot: $SNAPSHOT"
|
|
echo "Workers: $WORKERS"
|
|
echo "Output: $OUT"
|
|
|
|
"$PYTHON" scripts/run_fundamentals_research.py "$SNAPSHOT" \
|
|
--workers "$WORKERS" \
|
|
--candidate-cache reports/.cache/fundamentals-candidates.pkl \
|
|
--fundamentals-cache reports/.cache/fundamentals-scores.pkl \
|
|
--out "$OUT"
|
|
|
|
echo
|
|
echo "Bring this file back for review: ${OUT%.json}.zip"
|