1- # dashboard/pages/2_🧪_Backtest_Lab.py
21import streamlit as st
32import pandas as pd
43from pathlib import Path
5049
5150 # Immagine
5251 if (p / "chart.png" ).exists ():
53- st .image (str (p / "chart.png" ), width = True )
52+ # CORRETTO: use_container_width invece di width
53+ st .image (str (p / "chart.png" ), use_container_width = True )
5454
5555 # Metriche da JSON
5656 if (p / "config.json" ).exists ():
8484 sel_run = None
8585 if sel_strat :
8686 with c_run :
87- runs = sorted ([x .name for x in (base_dir / sel_strat ).iterdir ()], reverse = True )
88- sel_run = st .selectbox ("Select Timestamp" , runs )
87+ # Controllo se la cartella esiste e non è vuota
88+ strat_path = base_dir / sel_strat
89+ if strat_path .exists ():
90+ runs = sorted ([x .name for x in strat_path .iterdir ()], reverse = True )
91+ sel_run = st .selectbox ("Select Timestamp" , runs )
8992
9093 if sel_run :
9194 run_path = base_dir / sel_strat / sel_run
97100
98101 with col_img :
99102 if (run_path / "chart.png" ).exists ():
100- st .image (str (run_path / "chart.png" ), width = True )
103+ # CORRETTO: use_container_width
104+ st .image (str (run_path / "chart.png" ), use_container_width = True )
101105
102106 with col_data :
103107 if (run_path / "config.json" ).exists ():
106110 st .json (conf , expanded = False )
107111
108112 if (run_path / "trades.csv" ).exists ():
109- st .dataframe (pd .read_csv (run_path / "trades.csv" ), width = True , height = 300 )
113+ # CORRETTO: use_container_width e height numerico
114+ st .dataframe (pd .read_csv (run_path / "trades.csv" ), use_container_width = True , height = 300 )
0 commit comments