-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·52 lines (45 loc) · 2 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·52 lines (45 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bash
# One-time environment + data setup for equity_forecast.
# - creates a single shared venv on the SSD (keeps the SD card / git tree clean)
# - installs the pinned forecasting stack
# - verifies the tricky numba/statsforecast imports up front (fail fast)
# - downloads + unzips the Kaggle dataset
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SSD="${EQUITY_FORECAST_HOME:-/mnt/ssd/equity_forecast}"
VENV="$SSD/venv"
DATA="$SSD/data"
RAW="$DATA/raw"
PY="${PYTHON:-python3}"
echo "[setup] root=$ROOT ssd=$SSD python=$($PY --version 2>&1)"
mkdir -p "$DATA" "$RAW"
# 1. venv ------------------------------------------------------------------
if [ ! -x "$VENV/bin/python" ]; then
echo "[setup] creating venv at $VENV"
"$PY" -m venv "$VENV"
fi
# shellcheck disable=SC1091
source "$VENV/bin/activate"
python -m pip install --upgrade pip wheel >/dev/null
# 2. deps (pinned) ---------------------------------------------------------
echo "[setup] installing pinned requirements (a few minutes on ARM the first time)…"
pip install -r "$ROOT/requirements.txt"
# 3. verify the load-bearing imports --------------------------------------
echo "[setup] verifying forecasting stack…"
python - <<'PY'
import numba, llvmlite, statsforecast, mlforecast, utilsforecast, lightgbm, polars, pyarrow, shap
print(" OK numba", numba.__version__, "| statsforecast", statsforecast.__version__,
"| mlforecast", mlforecast.__version__, "| lightgbm", lightgbm.__version__,
"| polars", polars.__version__)
PY
# 4. dataset ---------------------------------------------------------------
SLUG="kalyan197/nifty50-stocks1999-2026-daily-ohlcv-and-fundamentals"
if [ ! -f "$RAW/nifty50_historical_data.csv" ]; then
echo "[setup] downloading Kaggle dataset → $RAW"
kaggle datasets download -d "$SLUG" -p "$RAW" --unzip
else
echo "[setup] dataset already present, skipping download"
fi
echo "[setup] done. Files:"
ls -la "$RAW"
echo "[setup] next: ./run.sh data.py materialise && ./run.sh eda.py"