Strategy adding

Once you decide to try more ideas and develop more strategies, using the one strategy — one file approach may become necessary. Let’s have a look at how to add new strategies in the off-line development package.

Creating a new C++ strategy

1. Create a strategy folder

  • In the strategies folder create a copy of the sample_strategy folder
  • Choose a name of your strategy.

Let’s call it strategy_name.

  • Rename the new folder with json and cpp files inside with the strategy_name, strategy_name.json, strategy_name.cpp respectively.

2. Register your strategy

Once the files are copied you need to edit cpp file.

Register your new strategy with the following command at the end of the cpp file:

REGISTER_CONTEST_STRATEGY(UserStrategy, strategy_name)

Let’s say your folder, .json-file and the strategy are called best_strategy_ever. You will therefore need to add the following line at the end of the file best_strategy_ever.cpp:

REGISTER_CONTEST_STRATEGY(UserStrategy, best_strategy_ever)

This is necessary due to specifics of the simulator’s dynamic linkage process of the strategies.

3. Update CMake configuration

  • Those of you who work in cli run the following script
  • Those working in CLion, go to Tools > CMake > Reload CMake Project.

Creating a new Python strategy

Unfortunately, there is currently no way to create new folders for Python strategies. Please write your strategy in the strategies/python_strategy/ file. You may find out here how to run the strategy.

results matching ""

    No results matching ""