From 1595e5fd8a69de366c8b4710e75e7099a91db027 Mon Sep 17 00:00:00 2001 From: Timothy Pogue Date: Thu, 6 Oct 2022 21:00:28 -0600 Subject: [PATCH] small fix in protocol --- scripts/ws_client.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/ws_client.py b/scripts/ws_client.py index 51ba0ee83..0cc076641 100644 --- a/scripts/ws_client.py +++ b/scripts/ws_client.py @@ -181,13 +181,14 @@ class ClientProtocol: async def _handle_default(self, name, type, data): key, la, df = data['key'], data['la'], data['df'] - columns = ", ".join([str(column) for column in df.columns]) + if not df.empty: + columns = ", ".join([str(column) for column in df.columns]) - self.logger.info(key) - self.logger.info(f"Last analyzed datetime: {la}") - self.logger.info(f"Latest candle datetime: {df.iloc[-1]['date']}") - self.logger.info(f"DataFrame length: {len(df)}") - self.logger.info(f"DataFrame columns: {columns}") + self.logger.info(key) + self.logger.info(f"Last analyzed datetime: {la}") + self.logger.info(f"Latest candle datetime: {df.iloc[-1]['date']}") + self.logger.info(f"DataFrame length: {len(df)}") + self.logger.info(f"DataFrame columns: {columns}") async def create_client( @@ -275,6 +276,7 @@ async def create_client( logger.error("Unexpected error has occurred:") logger.exception(e) + await asyncio.sleep(sleep_time) continue