Skip to content

How to use the Strategy Optimizer (CLI) #2969

@JOduMonT

Description

@JOduMonT

Step 1: Have you search for this issue before posting it?

yes I found these

Step 2: Describe your environment

  • OS : I run Octobot 2.0.10 via Docker on an Ubuntu 24.04 LTS
  • Python Version: Python 3.10.12 (in the Docker Image)

Step 3: Describe the problem:

Describe the bug
as describe by ./OctoBot --help

-o STRATEGY_OPTIMIZER [STRATEGY_OPTIMIZER ...], --strategy_optimizer STRATEGY_OPTIMIZER [STRATEGY_OPTIMIZER ...]`
Start Octobot strategy optimizer. This mode will make
octobot play backtesting scenarii located in
abstract_strategy_test.py with different timeframes,
evaluators and risk using the trading mode set in
config.json. This tool is useful to quickly test a
strategy and automatically find the best compatible
settings. Param is the name of the strategy class to
test. Example: -o TechnicalAnalysisStrategyEvaluator
Warning: this process may take a long time.

I want to Optimize my Strategy
So I tried...

Observed Results:

when

  • docker exec octobotContainer ./OctoBot -o TechnicalAnalysisStrategyEvaluator

which I think it's normal since I don't use TechnicalAnalysisStrategyEvaluator

 2025-05-28 14:59:11,957 INFO     OctoBot Launcher     Version : 2.0.10
 2025-05-28 14:59:11,957 INFO     OctoBot Launcher     Running self-hosted OctoBot on Linux:6.8.0-58-generic:x86_64 with binary [Python 3.10.12]
 2025-05-28 14:59:11,960 INFO     OctoBot Launcher     Loading config files...
 2025-05-28 14:59:11,964 INFO     Configuration        Using DailyTarget profile.
 2025-05-28 14:59:12,013 INFO     OctoBot Launcher     Disclaimer accepted by user.
 2025-05-28 14:59:12,206 INFO     CommunityAuthentication Signed in as [email protected]
 2025-05-28 14:59:13,162 INFO     telethon.crypto.aes  libssl detected, it will be used for encryption
 2025-05-28 14:59:13,679 INFO     StrategyOptimizer    StrategyOptimizer finished computation.
 2025-05-28 14:59:13,679 INFO     StrategyOptimizer    Logging level restored.
 2025-05-28 14:59:13,682 ERROR    root                   File "/octobot/./OctoBot", line 33, in <module>
    sys.exit(load_entry_point('OctoBot==2.0.10', 'console_scripts', 'OctoBot')())
  File "/opt/venv/lib/python3.10/site-packages/OctoBot-2.0.10-py3.10.egg/octobot/cli.py", line 564, in main
    args.func(args)
  File "/opt/venv/lib/python3.10/site-packages/OctoBot-2.0.10-py3.10.egg/octobot/cli.py", line 481, in <lambda>
    parser.set_defaults(func= lambda args: start_octobot(args, default_config_file))
  File "/opt/venv/lib/python3.10/site-packages/OctoBot-2.0.10-py3.10.egg/octobot/cli.py", line 379, in start_octobot
    commands.start_strategy_optimizer(config, args.strategy_optimizer)
  File "/opt/venv/lib/python3.10/site-packages/OctoBot-2.0.10-py3.10.egg/octobot/commands.py", line 79, in start_strategy_optimizer
    strategy_optimizer_api.find_optimal_configuration(optimizer)
  File "/opt/venv/lib/python3.10/site-packages/OctoBot-2.0.10-py3.10.egg/octobot/api/strategy_optimizer.py", line 61, in find_optimal_configuration
    strategy_optimizer.find_optimal_configuration(TAs=TAs, time_frames=time_frames, risks=risks)
  File "/opt/venv/lib/python3.10/site-packages/OctoBot-2.0.10-py3.10.egg/octobot/strategy_optimizer/strategy_optimizer.py", line 105, in find_optimal_configuration
    self.all_time_frames = self.strategy_class.get_required_time_frames(self.config,
  File "/opt/venv/lib/python3.10/site-packages/octobot_evaluators/evaluators/strategy_evaluator.py", line 406, in get_required_time_frames
    strategy_config: dict = strategy_config or api.get_tentacle_config(tentacles_setup_config, cls)
  File "/opt/venv/lib/python3.10/site-packages/octobot_tentacles_manager/api/configurator.py", line 184, in get_tentacle_config
    return configuration.get_config(tentacles_setup_config, klass)
  File "/opt/venv/lib/python3.10/site-packages/octobot_tentacles_manager/configuration/tentacle_configuration.py", line 54, in get_config
    return _GET_CONFIG_PROXY(tentacles_setup_config, klass)
  File "/opt/venv/lib/python3.10/site-packages/octobot_tentacles_manager/configuration/tentacle_configuration.py", line 28, in _get_config_from_file_system
    config_path = _get_config_file_path(tentacles_setup_config, klass)
  File "/opt/venv/lib/python3.10/site-packages/octobot_tentacles_manager/configuration/tentacle_configuration.py", line 113, in _get_config_file_path
    return _get_reference_config_file_path(klass)
  File "/opt/venv/lib/python3.10/site-packages/octobot_tentacles_manager/configuration/tentacle_configuration.py", line 98, in _get_reference_config_file_path
    return path.join(_get_reference_config_path(klass), _get_config_file_name(klass))
  File "/opt/venv/lib/python3.10/site-packages/octobot_tentacles_manager/configuration/tentacle_configuration.py", line 94, in _get_reference_config_path
    return path.join(loaders.get_tentacle_module_path(klass), constants.TENTACLE_CONFIG)
  File "/opt/venv/lib/python3.10/site-packages/octobot_tentacles_manager/loaders/tentacle_loading.py", line 53, in get_tentacle_module_path
    tentacle = get_tentacle(klass)
  File "/opt/venv/lib/python3.10/site-packages/octobot_tentacles_manager/loaders/tentacle_loading.py", line 99, in get_tentacle
    raise RuntimeError(f"tentacle have not been initialized, call reload_tentacle_by_tentacle_class "

NoneType: None
 2025-05-28 14:59:13,683 ERROR    root                 <class 'RuntimeError'>: tentacle have not been initialized, call reload_tentacle_by_tentacle_class fix this issue
NoneType: None
  • run docker exec octobotContainer ./OctoBot -o SimpleStrategyEvaluator
> 2025-05-28 14:52:54,999 ERROR    StrategyTestSuite    Exception when running test test_up_then_down: Error with independent backtesting: no available exchange manager (error: RuntimeError)

So I`m confuse and would like to guidance on how to use STRATEGY_OPTIMIZER

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions