@@ -7,6 +7,7 @@ export GID=$(id -g)
77# Colori
88GREEN=' \033[0;32m'
99RED=' \033[0;31m'
10+ YELLOW=' \033[1;33m' # Aggiunto giallo per info
1011NC=' \033[0m'
1112
1213# Verifica esistenza .env
@@ -17,8 +18,8 @@ if [ ! -f .env ]; then
1718fi
1819
1920case " $1 " in
20- setup)
21- echo -e " ${GREEN} Inizializzazione Petunia Environment...${NC} "
21+ setup)
22+ echo -e " ${GREEN} Inizializzazione Petunia Environment...${NC} "
2223
2324 # 1. Creiamo le cartelle utente (Log e Credenziali)
2425 mkdir -p logs config/credentials
@@ -28,13 +29,12 @@ case "$1" in
2829 docker compose build
2930 ;;
3031
31- start)
32+ start)
3233 echo -e " ${GREEN} Avvio Infrastruttura (DB + Dashboard)...${NC} "
33- # Aggiungiamo 'dashboard' alla lista dei servizi da avviare
3434 docker compose up -d db dashboard
3535 ;;
3636
37- init)
37+ init)
3838 echo -e " ${GREEN} Inizializzazione Tabelle DB...${NC} "
3939 docker compose run --rm app python -m services.init_db
4040 ;;
@@ -50,16 +50,24 @@ case "$1" in
5050 ;;
5151
5252 backtest)
53- echo -e " ${GREEN} Running Backtest...${NC} "
54- docker compose run --rm app python -m services.backtest
53+ # Catturiamo gli argomenti extra (es: ALL o EMA)
54+ ARGS=" ${@: 2} "
55+ if [ -z " $ARGS " ]; then
56+ INFO=" (Default Active Strategy)"
57+ else
58+ INFO=" (Target: $ARGS )"
59+ fi
60+
61+ echo -e " ${GREEN} Running Backtest $INFO ...${NC} "
62+ # Passiamo gli argomenti extra allo script Python
63+ docker compose run --rm app python -m services.backtest $ARGS
5564 ;;
5665
57- test)
66+ test)
5867 echo -e " ${GREEN} Running Tests (Pytest inside Docker)...${NC} "
59- # Esegue pytest sulla cartella tests/ con verbosità attiva (-v)
6068 docker compose run --rm app pytest tests/ -v
6169 ;;
62-
70+
6371 shell)
6472 echo -e " ${GREEN} Opening Shell...${NC} "
6573 docker compose run --rm -it app /bin/bash
@@ -74,13 +82,33 @@ case "$1" in
7482 docker compose down
7583 ;;
7684
77- dashboard)
78- echo " Log Dashboard (Streamlit)..."
85+ dashboard)
86+ echo " Log Dashboard (Streamlit)..."
7987 docker compose logs -f dashboard
8088 ;;
8189
82- * )
83- echo " Usage: $0 {setup|start|stop|status|daily|weekly|backtest|test|shell|dashboard}"
90+ * )
91+ echo -e " ${YELLOW} Usage: $0 {command} [args]${NC} "
92+ echo " --------------------------------------------------------"
93+ echo " 🛠️ SETUP:"
94+ echo " setup -> Build images & create folders"
95+ echo " init -> Create DB schema (Warning: resets data)"
96+ echo " "
97+ echo " 🚀 RUNTIME:"
98+ echo " start -> Start DB & Dashboard (background)"
99+ echo " stop -> Stop all containers"
100+ echo " status -> Check containers status"
101+ echo " dashboard -> View Dashboard logs"
102+ echo " "
103+ echo " 🧠 SERVICES:"
104+ echo " daily -> Run Data Fetch & Portfolio Update"
105+ echo " weekly -> Run Strategy Analysis (Friday)"
106+ echo " backtest -> Run Simulation (Args: ALL, EMA, RSI)"
107+ echo " "
108+ echo " 💻 DEV:"
109+ echo " test -> Run Pytest Suite"
110+ echo " shell -> Open Bash inside App container"
111+ echo " --------------------------------------------------------"
84112 exit 1
85113 ;;
86114esac
0 commit comments