Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index #2570

Merged
merged 3 commits into from
Mar 24, 2024
Merged

Index #2570

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions octobot/backtesting/abstract_backtesting_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
4 changes: 3 additions & 1 deletion octobot/community/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand All @@ -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.")
Expand Down
Binary file not shown.
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
17 changes: 11 additions & 6 deletions tests/test_utils/memory_check_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

exchange_manager = get_exchange_manager_from_exchange_id(
get_independent_backtesting_exchange_manager_ids(backtesting)[0])
trades = get_trade_history(exchange_manager)
Expand All @@ -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
Loading