From c19a5fbe06e35839255ad0b961d20c39299b7e1d Mon Sep 17 00:00:00 2001 From: Timothy Pogue Date: Mon, 12 Sep 2022 13:57:29 -0600 Subject: [PATCH] copy data being transferred, remove debug messages in emc --- freqtrade/data/dataprovider.py | 3 ++- freqtrade/rpc/external_message_consumer.py | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/freqtrade/data/dataprovider.py b/freqtrade/data/dataprovider.py index 94e79c8be..e3bee7118 100644 --- a/freqtrade/data/dataprovider.py +++ b/freqtrade/data/dataprovider.py @@ -184,7 +184,8 @@ class DataProvider: return (DataFrame(), datetime.fromtimestamp(0, tz=timezone.utc)) # We have it, return this data - return self.__producer_pairs_df[producer_name][pair_key] + df, la = self.__producer_pairs_df[producer_name][pair_key] + return (df.copy(), la) def add_pairlisthandler(self, pairlists) -> None: """ diff --git a/freqtrade/rpc/external_message_consumer.py b/freqtrade/rpc/external_message_consumer.py index bd921cf8e..89edc8417 100644 --- a/freqtrade/rpc/external_message_consumer.py +++ b/freqtrade/rpc/external_message_consumer.py @@ -269,6 +269,10 @@ class ExternalMessageConsumer: logger.error(f"Invalid message from `{producer_name}`: {e}") return + if not producer_message.data: + logger.error(f"Empty message received from `{producer_name}`") + return + logger.info(f"Received message of type `{producer_message.type}` from `{producer_name}`") message_handler = self._message_handlers.get(producer_message.type) @@ -282,32 +286,29 @@ class ExternalMessageConsumer: def _consume_whitelist_message(self, producer_name: str, message: WSMessageSchema): try: # Validate the message - message = WSWhitelistMessage.parse_obj(message) + whitelist_message = WSWhitelistMessage.parse_obj(message) except ValidationError as e: logger.error(f"Invalid message from `{producer_name}`: {e}") return # Add the pairlist data to the DataProvider - self._dp._set_producer_pairs(message.data, producer_name=producer_name) + self._dp._set_producer_pairs(whitelist_message.data.copy(), producer_name=producer_name) logger.debug(f"Consumed message from `{producer_name}` of type `RPCMessageType.WHITELIST`") def _consume_analyzed_df_message(self, producer_name: str, message: WSMessageSchema): try: - message = WSAnalyzedDFMessage.parse_obj(message) + df_message = WSAnalyzedDFMessage.parse_obj(message) except ValidationError as e: logger.error(f"Invalid message from `{producer_name}`: {e}") return - key = message.data.key - df = message.data.df - la = message.data.la + key = df_message.data.key + df = df_message.data.df + la = df_message.data.la pair, timeframe, candle_type = key - logger.debug(message.data.key) - logger.debug(message.data) - # If set, remove the Entry and Exit signals from the Producer if self._emc_config.get('remove_entry_exit_signals', False): df = remove_entry_exit_signals(df)