Skip to content

Commit af3f7fd

Browse files
authored
Merge pull request #215 from hummingbot/fix/handle-missing-executors-in-performance-page
(fix) handle missing executors in performance page
2 parents a6ac480 + ee44800 commit af3f7fd

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

frontend/visualization/bot_performance.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ def display_global_results(data_source: PerformanceDataSource):
109109
@st.cache_data(show_spinner=False)
110110
def fetch_global_results(executors_dict: List[Dict[str, Any]]):
111111
backend_api = get_backend_api_client()
112-
results_response = backend_api.get_performance_results(executors=executors_dict)
112+
if len(executors_dict) > 0:
113+
results_response = backend_api.get_performance_results(executors=executors_dict)
114+
else:
115+
results_response = {}
113116
return results_response.get("results", {})
114117

115118

@@ -145,14 +148,20 @@ def display_side_analysis(data_source: PerformanceDataSource,
145148
@st.cache_data(show_spinner=False)
146149
def fetch_long_results(executors_dict: List[Dict[str, Any]]):
147150
backend_api = get_backend_api_client()
148-
results_response = backend_api.get_performance_results(executors=executors_dict)
151+
if len(executors_dict) > 0:
152+
results_response = backend_api.get_performance_results(executors=executors_dict)
153+
else:
154+
results_response = {}
149155
return results_response.get("results", {})
150156

151157

152158
@st.cache_data(show_spinner=False)
153159
def fetch_short_results(executors_dict: List[Dict[str, Any]]):
154160
backend_api = get_backend_api_client()
155-
results_response = backend_api.get_performance_results(executors=executors_dict)
161+
if len(executors_dict) > 0:
162+
results_response = backend_api.get_performance_results(executors=executors_dict)
163+
else:
164+
results_response = {}
156165
return results_response.get("results", {})
157166

158167

@@ -234,7 +243,10 @@ def fetch_market_data(params: Dict[str, Any] = None):
234243
@st.cache_data()
235244
def fetch_performance_results(executors_dict: List[Dict[str, Any]]):
236245
backend_api = get_backend_api_client()
237-
results_response = backend_api.get_performance_results(executors=executors_dict)
246+
if len(executors_dict) > 0:
247+
results_response = backend_api.get_performance_results(executors=executors_dict)
248+
else:
249+
results_response = {}
238250
return results_response.get("results", {})
239251

240252

0 commit comments

Comments
 (0)