From f77d84876a3eb643c787fc35b21e87b8858c0ad6 Mon Sep 17 00:00:00 2001 From: froggleston Date: Mon, 10 Feb 2025 12:26:54 +0000 Subject: [PATCH 1/2] Fix dash open table if shorting --- ftui/screens/dashboard_screen.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ftui/screens/dashboard_screen.py b/ftui/screens/dashboard_screen.py index 87fe55b..8f7bfdd 100644 --- a/ftui/screens/dashboard_screen.py +++ b/ftui/screens/dashboard_screen.py @@ -281,18 +281,26 @@ def update_dashboard_all_open_trades(self): client_dict = self.app.client_dict client_dfs = self.app.client_dfs + trading_mode = "spot" + all_open_df = pd.DataFrame() for n, cl in client_dict.items(): + # if any bots are in futures mode, add leverage column + tm = cl.get_client_config().get("trading_mode") + if tm != "spot": + trading_mode = tm if cl.name in client_dfs and "op_data" in client_dfs[cl.name]: data = client_dfs[cl.name]["op_data"].copy() if not data.empty: all_open_df = pd.concat([all_open_df, data]) - row_data = self._render_open_trade_data(all_open_df) + row_data = self._render_open_trade_data( + all_open_df, trading_mode=trading_mode + ) dt = self.query_one("#all-open-trades-table") table = fth.dash_open_trades_table( - row_data, trading_mode=cl.get_client_config().get("trading_mode") + row_data, trading_mode=trading_mode ) worker = get_current_worker() From d1cec12dd97f6ef8987d3ed47eb18dc176ed2502 Mon Sep 17 00:00:00 2001 From: froggleston Date: Mon, 10 Feb 2025 12:28:54 +0000 Subject: [PATCH 2/2] Add default to spot if trading_mode fails --- ftui/screens/dashboard_screen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftui/screens/dashboard_screen.py b/ftui/screens/dashboard_screen.py index 8f7bfdd..6aa27bc 100644 --- a/ftui/screens/dashboard_screen.py +++ b/ftui/screens/dashboard_screen.py @@ -286,7 +286,7 @@ def update_dashboard_all_open_trades(self): all_open_df = pd.DataFrame() for n, cl in client_dict.items(): # if any bots are in futures mode, add leverage column - tm = cl.get_client_config().get("trading_mode") + tm = cl.get_client_config().get("trading_mode", "spot") if tm != "spot": trading_mode = tm if cl.name in client_dfs and "op_data" in client_dfs[cl.name]: