From b84032ad006f2afb1234be294de27bd105d30cbd Mon Sep 17 00:00:00 2001 From: Guillaume De Saint Martin Date: Wed, 4 Mar 2026 22:30:28 +0100 Subject: [PATCH] [Profiles] enable local profiles and disable socal collectors by default --- octobot_script/constants.py | 3 +++ octobot_script/internal/octobot_mocks.py | 2 +- octobot_script/model/backtest_plot.py | 10 +++++++--- profile_example.py | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/octobot_script/constants.py b/octobot_script/constants.py index 5bf8f30..95817bd 100644 --- a/octobot_script/constants.py +++ b/octobot_script/constants.py @@ -13,7 +13,10 @@ # # You should have received a copy of the GNU General Public # License along with OctoBot-Script. If not, see . +import os ADDITIONAL_IMPORT_PATH = "imports" CONFIG_PATH = "config" + +PROFILES_PATH = os.getenv("PROFILES_PATH") diff --git a/octobot_script/internal/octobot_mocks.py b/octobot_script/internal/octobot_mocks.py index 74e80cc..9e69910 100644 --- a/octobot_script/internal/octobot_mocks.py +++ b/octobot_script/internal/octobot_mocks.py @@ -133,7 +133,7 @@ def get_activated_social_services(forced_tentacles_by_topic=None, profile_id=Non def _get_tentacles_config_path(profile_id=None): if profile_id: profile = commons_profiles.Profile.load_profile( - os.path.join(get_module_appdir_path(), commons_constants.USER_PROFILES_FOLDER), + constants.PROFILES_PATH or os.path.join(get_module_appdir_path(), commons_constants.USER_PROFILES_FOLDER), profile_id, ) return profile.get_tentacles_config_path() diff --git a/octobot_script/model/backtest_plot.py b/octobot_script/model/backtest_plot.py index e38b5f8..022dec8 100644 --- a/octobot_script/model/backtest_plot.py +++ b/octobot_script/model/backtest_plot.py @@ -57,9 +57,13 @@ async def fill(self, template_file=None): template_name = template_file or self.DEFAULT_TEMPLATE template_data = await self._get_template_data() report_dir = os.path.dirname(os.path.abspath(self.report_file)) - shutil.copy2( - resources.get_report_resource_path(template_name), self.report_file - ) + try: + shutil.copy2( + resources.get_report_resource_path(template_name), self.report_file + ) + except FileNotFoundError: + if not os.path.exists(resources.get_report_resource_path(template_name)): + raise FileNotFoundError(f"Missing report template. Please generate report templates.") meta = template_data["meta"] with open( os.path.join(report_dir, self.REPORT_DATA_FILENAME), "w", encoding="utf-8" diff --git a/profile_example.py b/profile_example.py index adfcdfd..f79c23e 100644 --- a/profile_example.py +++ b/profile_example.py @@ -12,6 +12,7 @@ async def start_profile(): "1d", start_timestamp=1505606400, profile_id=profile_id, + social_services=[] # disable social data fetching ) # Run a backtest using the above data, strategy and configuration. res = await obs.run(data, config, profile_id=profile_id)