How to use the octobot.api.strategy_optimizer.is_optimizer_computing function in OctoBot

To help you get started, we’ve selected a few OctoBot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Drakkar-Software / OctoBot-Tentacles / Services / Interfaces / web_interface / models / strategy_optimizer.py View on Github external
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
github Drakkar-Software / OctoBot-Tentacles / Services / Interfaces / web_interface / models / strategy_optimizer.py View on Github external
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,