Optimization

Deployment

Introduction

Deploy optimization jobs for your trading algorithms to optimize your algorithm parameters for the objective that you specify. The optimizer runs concurrent backtests to optimize your algorithm parameter using up to 24 nodes. As the optimization runs, the results are displayed and updated in real-time.

Resources

The optimization nodes that backtest your algorithm are not the backtesting nodes in your organization. The optimization nodes are a cluster of nodes that exclusively run optimization jobs. The optimization can run with up to 24 nodes. If you use multiple nodes, the backtests run concurrently and all of the nodes are the same model. The following table shows the specifications of the optimization node models:

ModelNumber of CoresRAM (GB)
O2-828
O4-12412
O8-16816

Select the optimization node that is most appropriate for your trading algorithm. The following table explains when to use each model:

ModelDescription
O2-8Relatively simple strategies with less than 100 assets
O4-12Strategies with less than 500 assets and simple universe selections
O8-16Complex strategies and machine learning

The following table shows the training quotas of the optimization nodes:

ModelCapacity (min)Refill Rate (min/day)
O2-8305
O4-126010
O8-169015

Cost

You can rent optimization nodes on a time basis. The deployment wizard estimates the total cost of your optimization job based on the results of the last successful backtest of your algorithm, the number of parameters, and the optimization strategy. Therefore, you must run a backtest of your algorithm before the deployment wizard can estimate the cost of the optimization job. The final cost that you pay can vary from the estimate. For instance, if your backtest used parameters that were favorable for speedy execution, the estimate can be lower than the final cost.

You can use multiple nodes to speed up the optimization job without the job costing more because you use each node for a shorter period of time. However, there is a spin-up time of roughly 15 seconds on each backtest, so it can sometimes cost more to use many nodes when you factor in the spin-up time. You pay for optimizations with your organization's QuantConnect Credit balance. If you have your own hardware, you can run local optimizations with your own data and hardware.

Launch Optimization Jobs

You need the following to optimize parameters:

  • At least one algorithm parameter in your project.
  • The GetParameter method or Parameter attribute in your project.
  • A successful backtest of the project.
  • QuantConnect Credit (QCC) in your organization.

Follow these steps to optimize parameters:

  1. Open the project that contains the parameters you want to optimize.
  2. In the top-right corner of the IDE, click the Optimize icon.
  3. On the Optimization page, in the Parameter & Constraints section, enter the name of the parameter to optimize.
  4. The parameter name must match a parameter name in the Project panel.

  5. Enter the minimum and maximum parameter values.
  6. Click the gear icon next to the parameter and then enter a step size.
  7. If you want to add a second parameter to optimize, click Add Parameter.
  8. You can optimize a maximum of two parameters. To optimize more parameters, run local optimizations.

  9. If you want to add optimization constraints, follow these steps:
    1. Click Add Constraint.
    2. Click the target field and then select a target from the drop-down menu.
    3. Click the operation field and then an operation from the drop-down menu.
    4. Enter a constraint value.
  10. In the Estimated Number and Cost of Backtests, click an optimization node.
  11. Select a maximum number of nodes to use.
  12. In the Estimated Number and Cost of Backtests, click the Choose Optimization Strategy field and then select a strategy from the drop-down menu.
  13. Click the Select Target field and then select a target from the drop-down menu.
  14. The target (also known as objective) is the performance metric the optimizer uses to compare the backtest performance of different parameter values.

  15. Click Maximize or Minimize to maximize or minimize the optimization target, respectively.
  16. Click Launch Optimization.
  17. The optimization results page displays. As the optimization job runs, you can close or refresh the window without interrupting the job because the nodes are processing on our servers.

    To abort a running optimization job, in the Status panel, click Abort and then click Yes.

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: