diff --git a/CHANGELOG.md b/CHANGELOG.md index 65ac555e..cdd017ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.9.34] - 2023-12-11 +### Added +- Profiles: extra_backtesting_time_frames + ## [1.9.33] - 2023-12-08 ### Added - Enums: TRIGGER_HEALTH_CHECK diff --git a/README.md b/README.md index 63acba9e..7d535e16 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# OctoBot-Commons [1.9.33](https://github.com/Drakkar-Software/OctoBot-Commons/blob/master/CHANGELOG.md) +# OctoBot-Commons [1.9.34](https://github.com/Drakkar-Software/OctoBot-Commons/blob/master/CHANGELOG.md) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/b31f3ab3511744a5a5ca6b9bb48e77bb)](https://app.codacy.com/gh/Drakkar-Software/OctoBot-Commons?utm_source=github.com&utm_medium=referral&utm_content=Drakkar-Software/OctoBot-Commons&utm_campaign=Badge_Grade_Dashboard) [![PyPI](https://img.shields.io/pypi/v/OctoBot-Commons.svg)](https://pypi.python.org/pypi/OctoBot-Commons/) [![Coverage Status](https://coveralls.io/repos/github/Drakkar-Software/OctoBot-Commons/badge.svg?branch=master)](https://coveralls.io/github/Drakkar-Software/OctoBot-Commons?branch=master) diff --git a/octobot_commons/__init__.py b/octobot_commons/__init__.py index a8bf555b..166302d7 100644 --- a/octobot_commons/__init__.py +++ b/octobot_commons/__init__.py @@ -16,7 +16,7 @@ # License along with this library. PROJECT_NAME = "OctoBot-Commons" -VERSION = "1.9.33" # major.minor.revision +VERSION = "1.9.34" # major.minor.revision MARKET_SEPARATOR = "/" SETTLEMENT_ASSET_SEPARATOR = ":" diff --git a/octobot_commons/constants.py b/octobot_commons/constants.py index 0d9904e9..f78d16fb 100644 --- a/octobot_commons/constants.py +++ b/octobot_commons/constants.py @@ -66,6 +66,7 @@ CONFIG_ORIGIN_URL = "origin_url" CONFIG_READ_ONLY = "read_only" CONFIG_IMPORTED = "imported" +CONFIG_EXTRA_BACKTESTING_TIME_FRAMES = "extra_backtesting_time_frames" CONFIG_COMPLEXITY = "complexity" CONFIG_RISK = "risk" CONFIG_TYPE = "type" @@ -90,6 +91,7 @@ CONFIG_EXCHANGE_PASSWORD = "api-password" CONFIG_EXCHANGE_TYPE = "exchange-type" CONFIG_CONTRACT_TYPE = "contract-type" +CONFIG_REQUIRED_EXTRA_TIMEFRAMES = "required_extra_timeframes" CONFIG_EXCHANGE_SANDBOXED = "sandboxed" CONFIG_EXCHANGE_FUTURE = "future" CONFIG_EXCHANGE_MARGIN = "margin" diff --git a/octobot_commons/profiles/profile.py b/octobot_commons/profiles/profile.py index 60e93373..9411bc5d 100644 --- a/octobot_commons/profiles/profile.py +++ b/octobot_commons/profiles/profile.py @@ -72,6 +72,7 @@ def __init__(self, profile_path: str, schema_path: str = None): self.complexity: enums.ProfileComplexity = enums.ProfileComplexity.MEDIUM self.risk: enums.ProfileRisk = enums.ProfileRisk.MODERATE self.profile_type: enums.ProfileType = enums.ProfileType.LIVE + self.extra_backtesting_time_frames = [] self.config: dict = {} @@ -106,6 +107,9 @@ def from_dict(self, profile_dict: dict): self.profile_type = enums.ProfileType( profile_config.get(constants.CONFIG_TYPE, enums.ProfileType.LIVE.value) ) + self.extra_backtesting_time_frames = profile_config.get( + constants.CONFIG_EXTRA_BACKTESTING_TIME_FRAMES, [] + ) self.config = profile_dict[constants.PROFILE_CONFIG] if self.avatar and self.path: avatar_path = os.path.join(self.path, self.avatar) @@ -250,6 +254,7 @@ def as_dict(self) -> dict: constants.CONFIG_TYPE: self.profile_type.value if self.profile_type else None, + constants.CONFIG_EXTRA_BACKTESTING_TIME_FRAMES: self.extra_backtesting_time_frames, }, constants.PROFILE_CONFIG: self.config, } diff --git a/octobot_commons/profiles/profile_data_import.py b/octobot_commons/profiles/profile_data_import.py index 007e8abe..74d45728 100644 --- a/octobot_commons/profiles/profile_data_import.py +++ b/octobot_commons/profiles/profile_data_import.py @@ -25,6 +25,9 @@ import octobot_commons.enums as enums IMPORTED_AVATAR = "avatar" +IMPORTED_PROFILES_DEFAULT_EXTRA_BACKTESTING_TIMEFRAME = ( + enums.TimeFrames.FIFTEEN_MINUTES.value +) async def convert_profile_data_to_profile_directory( @@ -79,6 +82,9 @@ def _get_profile( profile.risk = risk profile.profile_id = str(uuid.uuid4().hex) profile.read_only = True + profile.extra_backtesting_time_frames = [ + IMPORTED_PROFILES_DEFAULT_EXTRA_BACKTESTING_TIMEFRAME + ] return profile diff --git a/tests/profiles/test_profile.py b/tests/profiles/test_profile.py index 3a199879..3ca2baa8 100644 --- a/tests/profiles/test_profile.py +++ b/tests/profiles/test_profile.py @@ -170,6 +170,7 @@ def test_as_dict(profile): constants.CONFIG_COMPLEXITY: enums.ProfileComplexity.MEDIUM.value, constants.CONFIG_RISK: enums.ProfileRisk.MODERATE.value, constants.CONFIG_TYPE: enums.ProfileType.LIVE.value, + constants.CONFIG_EXTRA_BACKTESTING_TIME_FRAMES: [], }, constants.PROFILE_CONFIG: {}, } @@ -180,6 +181,7 @@ def test_as_dict(profile): profile.complexity = enums.ProfileComplexity.DIFFICULT profile.risk = enums.ProfileRisk.LOW profile.profile_type = enums.ProfileType.BACKTESTING + profile.extra_backtesting_time_frames = [enums.TimeFrames.ONE_DAY.value] assert profile.as_dict() == { constants.CONFIG_PROFILE: { constants.CONFIG_ID: "default", @@ -192,6 +194,7 @@ def test_as_dict(profile): constants.CONFIG_COMPLEXITY: enums.ProfileComplexity.DIFFICULT.value, constants.CONFIG_RISK: enums.ProfileRisk.LOW.value, constants.CONFIG_TYPE: enums.ProfileType.BACKTESTING.value, + constants.CONFIG_EXTRA_BACKTESTING_TIME_FRAMES: [enums.TimeFrames.ONE_DAY.value], }, constants.PROFILE_CONFIG: { "a": 1