Skip to content

Commit 66fcfbb

Browse files
committed
fix: warnings and minor patches in dashboard
1 parent a09b837 commit 66fcfbb

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

dashboard/pages/backtest_lab.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# dashboard/pages/2_🧪_Backtest_Lab.py
21
import streamlit as st
32
import pandas as pd
43
from pathlib import Path
@@ -50,7 +49,8 @@
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():
@@ -84,8 +84,11 @@
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
@@ -97,7 +100,8 @@
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():
@@ -106,4 +110,5 @@
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

Comments
 (0)