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

[Optimizer] allow multi exchange backtests and handle settings fallbacks #2246

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions octobot/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@
OPTIMIZER_DEFAULT_MIN_MUTATION_PROBABILITY_PERCENT = decimal.Decimal(10)
OPTIMIZER_DEFAULT_MAX_MUTATION_NUMBER_MULTIPLIER = 3
OPTIMIZER_DEFAULT_DB_UPDATE_PERIOD = 15
OPTIMIZER_DEFAULT_TARGET_FITNESS_SCORE = None

# Databases
DEFAULT_MAX_TOTAL_RUN_DATABASES_SIZE = 1000000000 # 1GB
Expand Down
2 changes: 2 additions & 0 deletions octobot/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class OptimizerConfig(enum.Enum):
DATA_FILES = "data_files"
OPTIMIZER_CONFIG = "optimizer_config"
EXCHANGE_TYPE = "exchange_type"
EXCHANGE_IDS = "exchange_ids"
EXCHANGE_ID = "exchange_id"
QUEUE_SIZE = "queue_size"
EMPTY_THE_QUEUE = "empty_the_queue"
START_TIMESTAMP = "start_timestamp"
Expand Down
20 changes: 19 additions & 1 deletion octobot/strategy_optimizer/optimizer_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import octobot.strategy_optimizer.fitness_parameter as fitness_parameter
import octobot.strategy_optimizer.optimizer_filter as optimizer_filter
import octobot.strategy_optimizer.optimizer_constraint as optimizer_constraint
import octobot_backtesting.constants as backtesting_constants


class OptimizerSettings:
Expand All @@ -31,7 +32,24 @@ def __init__(self, settings_dict=None):
self.optimizer_config = settings_dict.get(enums.OptimizerConfig.OPTIMIZER_CONFIG.value, None)
self.randomly_chose_runs = settings_dict.get(enums.OptimizerConfig.RANDOMLY_CHOSE_RUNS.value,
constants.OPTIMIZER_DEFAULT_RANDOMLY_CHOSE_RUNS)
self.data_files = settings_dict.get(enums.OptimizerConfig.DATA_FILES.value)
self.data_files = settings_dict.get(
enums.OptimizerConfig.DATA_FILES.value,
[backtesting_constants.CONFIG_CURRENT_BOT_DATA],
)
if not isinstance(self.data_files, list):
self.data_files = [self.data_files]
if backtesting_constants.CONFIG_CURRENT_BOT_DATA in self.data_files:
self.data_files = [backtesting_constants.CONFIG_CURRENT_BOT_DATA]
self.exchange_ids = settings_dict.get(
enums.OptimizerConfig.EXCHANGE_IDS.value,
)
if not self.exchange_ids:
self.exchange_ids = [
settings_dict.get(enums.OptimizerConfig.EXCHANGE_ID.value)
]
self.exchange_type = settings_dict.get(
enums.OptimizerConfig.EXCHANGE_TYPE.value
)
self.start_timestamp = settings_dict.get(enums.OptimizerConfig.START_TIMESTAMP.value, None)
self.end_timestamp = settings_dict.get(enums.OptimizerConfig.END_TIMESTAMP.value, None)
self.required_idle_cores = int(settings_dict.get(enums.OptimizerConfig.IDLE_CORES.value,
Expand Down
Loading