Skip to content

Commit 0a8345f

Browse files
committed
[Profiles] enable local profiles and disable socal collectors by default
1 parent 6a25b12 commit 0a8345f

4 files changed

Lines changed: 12 additions & 4 deletions

File tree

octobot_script/constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
#
1414
# You should have received a copy of the GNU General Public
1515
# License along with OctoBot-Script. If not, see <https://www.gnu.org/licenses/>.
16+
import os
1617

1718

1819
ADDITIONAL_IMPORT_PATH = "imports"
1920
CONFIG_PATH = "config"
21+
22+
PROFILES_PATH = os.getenv("PROFILES_PATH")

octobot_script/internal/octobot_mocks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def get_activated_social_services(forced_tentacles_by_topic=None, profile_id=Non
133133
def _get_tentacles_config_path(profile_id=None):
134134
if profile_id:
135135
profile = commons_profiles.Profile.load_profile(
136-
os.path.join(get_module_appdir_path(), commons_constants.USER_PROFILES_FOLDER),
136+
constants.PROFILES_PATH or os.path.join(get_module_appdir_path(), commons_constants.USER_PROFILES_FOLDER),
137137
profile_id,
138138
)
139139
return profile.get_tentacles_config_path()

octobot_script/model/backtest_plot.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,13 @@ async def fill(self, template_file=None):
5757
template_name = template_file or self.DEFAULT_TEMPLATE
5858
template_data = await self._get_template_data()
5959
report_dir = os.path.dirname(os.path.abspath(self.report_file))
60-
shutil.copy2(
61-
resources.get_report_resource_path(template_name), self.report_file
62-
)
60+
try:
61+
shutil.copy2(
62+
resources.get_report_resource_path(template_name), self.report_file
63+
)
64+
except FileNotFoundError:
65+
if not os.path.exists(resources.get_report_resource_path(template_name)):
66+
raise FileNotFoundError(f"Missing report template. Please generate report templates.")
6367
meta = template_data["meta"]
6468
with open(
6569
os.path.join(report_dir, self.REPORT_DATA_FILENAME), "w", encoding="utf-8"

profile_example.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ async def start_profile():
1212
"1d",
1313
start_timestamp=1505606400,
1414
profile_id=profile_id,
15+
social_services=[] # disable social data fetching
1516
)
1617
# Run a backtest using the above data, strategy and configuration.
1718
res = await obs.run(data, config, profile_id=profile_id)

0 commit comments

Comments
 (0)