How to use the backtesting.strategy_optimizer.strategy_optimizer.StrategyOptimizer function in Backtesting

To help you get started, weโ€™ve selected a few Backtesting 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 / backtesting / strategy_optimizer / strategy_optimizer.py View on Github external
def get_sorted_results(results, time_frame=None):
        return sorted(StrategyOptimizer.get_filtered_results(results, time_frame),
                      key=lambda result: result.get_average_score(), reverse=True)
github Drakkar-Software / OctoBot / backtesting / strategy_optimizer / strategy_optimizer.py View on Github external
def get_all_TA(config_evaluator):
        return [evaluator
                for evaluator, activated in config_evaluator.items()
                if activated and StrategyOptimizer._is_relevant_evaluation_config(evaluator)]
github Drakkar-Software / OctoBot / tools / commands.py View on Github external
def start_strategy_optimizer(config, commands):
        from backtesting.strategy_optimizer.strategy_optimizer import StrategyOptimizer
        optimizer = StrategyOptimizer(config, commands[0])
        if optimizer.is_properly_initialized:
            optimizer.find_optimal_configuration()
            optimizer.print_report()
github Drakkar-Software / OctoBot / interfaces / web / models / strategy_optimizer.py View on Github external
def start_optimizer(strategy, time_frames, evaluators, risks):
    tools = get_bot().get_tools()
    tools[BOT_TOOLS_STRATEGY_OPTIMIZER] = StrategyOptimizer(get_bot().get_config(), strategy)
    optimizer = tools[BOT_TOOLS_STRATEGY_OPTIMIZER]
    backtester = tools[BOT_TOOLS_BACKTESTING]
    if optimizer.get_is_computing():
        return False, "Optimizer already running"
    elif backtester and backtester.get_is_computing():
        return False, "A backtesting is already running"
    else:
        formatted_time_frames = TimeFrameManager.parse_time_frames(time_frames)
        float_risks = [float(risk) for risk in risks]
        thread = threading.Thread(target=optimizer.find_optimal_configuration, args=(evaluators,
                                                                                     formatted_time_frames,
                                                                                     float_risks))
        thread.start()
        return True, "Optimizer started"