Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_optimizer_status():
optimizer = WebInterface.tools[BOT_TOOLS_STRATEGY_OPTIMIZER]
if optimizer:
if is_optimizer_computing(optimizer):
return "computing", get_optimizer_current_test_suite_progress(optimizer), \
get_optimizer_overall_progress(optimizer), \
get_optimizer_errors_description(optimizer)
else:
return "finished", 100, 100, get_optimizer_errors_description(optimizer)
else:
return "not started", 0, 0, None
def start_optimizer(strategy, time_frames, evaluators, risks):
try:
tools = WebInterface.tools
optimizer = tools[BOT_TOOLS_STRATEGY_OPTIMIZER]
if optimizer is not None and is_optimizer_computing(optimizer):
return False, "Optimizer already running"
independent_backtesting = tools[BOT_TOOLS_BACKTESTING]
if independent_backtesting and is_independent_backtesting_in_progress(independent_backtesting):
return False, "A backtesting is already running"
else:
formatted_time_frames = parse_time_frames(time_frames)
float_risks = [float(risk) for risk in risks]
temp_independent_backtesting = create_independent_backtesting(get_global_config(), None, [])
optimizer_config = run_in_bot_async_executor(
initialize_independent_backtesting_config(temp_independent_backtesting)
)
optimizer = create_strategy_optimizer(optimizer_config,
get_bot_api().get_edited_tentacles_config(),
strategy)
tools[BOT_TOOLS_STRATEGY_OPTIMIZER] = optimizer
thread = threading.Thread(target=find_optimal_configuration,