diff --git a/octobot/backtesting/abstract_backtesting_test.py b/octobot/backtesting/abstract_backtesting_test.py index a652dfbb2..d55b2b95c 100644 --- a/octobot/backtesting/abstract_backtesting_test.py +++ b/octobot/backtesting/abstract_backtesting_test.py @@ -100,6 +100,10 @@ "2020ADA/BTC": path.join(TEST_DATA_FILES_FOLDER, "ExchangeHistoryDataCollector_1588110698.1060486.data") } +MULTI_ASSETS_DATA_FILE = path.join( + constants.OPTIMIZER_DATA_FILES_FOLDER, "ExchangeHistoryDataCollector_1711122002.311132.data" +) + EXTENDED_DATA_FILES = { "ADA/BTC": path.join(constants.OPTIMIZER_DATA_FILES_FOLDER, "AbstractExchangeHistoryCollector_1581775117.1713624.data"), diff --git a/octobot/community/authentication.py b/octobot/community/authentication.py index 54b5f570a..ff028cd3a 100644 --- a/octobot/community/authentication.py +++ b/octobot/community/authentication.py @@ -40,7 +40,7 @@ def _bot_data_update(func): - async def wrapper(*args, **kwargs): + async def wrapper(*args, raise_errors=False, **kwargs): self = args[0] if not self.is_logged_in_and_has_selected_bot(): self.logger.debug(f"Skipping {func.__name__} update: no user selected bot.") @@ -49,6 +49,8 @@ async def wrapper(*args, **kwargs): self.logger.debug(f"bot_data_update: {func.__name__} initiated.") return await func(*args, **kwargs) except Exception as err: + if raise_errors: + raise err self.logger.exception(err, True, f"Error when calling {func.__name__} {err}") finally: self.logger.debug(f"bot_data_update: {func.__name__} completed.") diff --git a/octobot/strategy_optimizer/optimizer_data_files/ExchangeHistoryDataCollector_1711122002.311132.data b/octobot/strategy_optimizer/optimizer_data_files/ExchangeHistoryDataCollector_1711122002.311132.data new file mode 100644 index 000000000..2c082e464 Binary files /dev/null and b/octobot/strategy_optimizer/optimizer_data_files/ExchangeHistoryDataCollector_1711122002.311132.data differ diff --git a/requirements.txt b/requirements.txt index 8062da69d..07e426a55 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ # Drakkar-Software requirements -OctoBot-Commons==1.9.42 -OctoBot-Trading==2.4.66 +OctoBot-Commons==1.9.43 +OctoBot-Trading==2.4.67 OctoBot-Evaluators==1.9.4 OctoBot-Tentacles-Manager==2.9.10 OctoBot-Services==1.6.10 diff --git a/tests/test_utils/memory_check_util.py b/tests/test_utils/memory_check_util.py index c0de91762..f61b540c7 100644 --- a/tests/test_utils/memory_check_util.py +++ b/tests/test_utils/memory_check_util.py @@ -19,19 +19,22 @@ from octobot.api.backtesting import create_independent_backtesting, initialize_and_run_independent_backtesting, \ check_independent_backtesting_remaining_objects, stop_independent_backtesting, join_independent_backtesting, \ get_independent_backtesting_exchange_manager_ids -from octobot.backtesting.abstract_backtesting_test import DATA_FILES +from octobot.backtesting.abstract_backtesting_test import DATA_FILES, MULTI_ASSETS_DATA_FILE from octobot_commons.asyncio_tools import ErrorContainer from octobot_trading.api.exchange import get_exchange_manager_from_exchange_id from octobot_trading.api.orders import get_open_orders from octobot_trading.api.trades import get_trade_history -async def run_independent_backtestings_with_memory_check(config, tentacles_setup_config, backtesting_count=3): +async def run_independent_backtestings_with_memory_check( + config, tentacles_setup_config, backtesting_count=3, use_multiple_asset_data_file=False +): """ Will raise an error of an object is not deleted by garbage collector at the end of the backtesting process :param config: the global config to use in backtesting :param tentacles_setup_config: the tentacles setup config to use (with the tentacles to be tested) :param backtesting_count: number of backtestings to run to ensure no side effects, default is 3 + :param use_multiple_asset_data_file: when True, a multi symbol data file will be used :return: """ backtesting = None @@ -44,7 +47,7 @@ async def run_independent_backtestings_with_memory_check(config, tentacles_setup # enabling loggers is slowing down backtesting but can display useful debug info # from octobot.logger import init_logger # init_logger() - backtesting = await _run_backtesting(config, tentacles_setup_config) + backtesting = await _run_backtesting(config, tentacles_setup_config, use_multiple_asset_data_file) exchange_manager = get_exchange_manager_from_exchange_id( get_independent_backtesting_exchange_manager_ids(backtesting)[0]) trades = get_trade_history(exchange_manager) @@ -64,9 +67,11 @@ async def run_independent_backtestings_with_memory_check(config, tentacles_setup raise e -async def _run_backtesting(config, tentacles_setup_config): - backtesting = create_independent_backtesting(config, tentacles_setup_config, [DATA_FILES["ETH/USDT"]], "", - enable_storage=False) +async def _run_backtesting(config, tentacles_setup_config, use_multiple_asset_data_file): + data_file = MULTI_ASSETS_DATA_FILE if use_multiple_asset_data_file else DATA_FILES["ETH/USDT"] + backtesting = create_independent_backtesting( + config, tentacles_setup_config, [data_file], "", enable_storage=False + ) await initialize_and_run_independent_backtesting(backtesting, log_errors=False) await join_independent_backtesting(backtesting) return backtesting