# 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:

Model | Number of Cores | RAM (GB) |
---|---|---|

O2-8 | 2 | 8 |

O4-12 | 4 | 12 |

O8-16 | 8 | 16 |

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

Model | Description |
---|---|

O2-8 | Relatively simple strategies with less than 100 assets |

O4-12 | Strategies with less than 500 assets and simple universe selections |

O8-16 | Complex strategies and machine learning |

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

Model | Capacity (min) | Refill Rate (min/day) |
---|---|---|

O2-8 | 30 | 5 |

O4-12 | 60 | 10 |

O8-16 | 90 | 15 |

### 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:

- Open the project that contains the parameters you want to optimize.
- In the top-right corner of the IDE, click the Optimize icon.
- On the Optimization page, in the Parameter & Constraints section, enter the name of the parameter to optimize.
- Enter the minimum and maximum parameter values.
- Click the gear icon next to the parameter and then enter a step size.
- If you want to add a second parameter to optimize, click .
- If you want to add optimization constraints, follow these steps:
- Click .
- Click the target field and then select a target from the drop-down menu.
- Click the operation field and then an operation from the drop-down menu.
- Enter a constraint value.
- In the Estimated Number and Cost of Backtests, click an optimization node.
- Select a maximum number of nodes to use.
- In the Estimated Number and Cost of Backtests, click the Choose Optimization Strategy field and then select a strategy from the drop-down menu.
- Click the Select Target field and then select a target from the drop-down menu.
- Click Maximize or Minimize to maximize or minimize the optimization target, respectively.
- Click .

The parameter name must match a parameter name in the Project panel.

You can optimize a maximum of two parameters. To optimize more parameters, run local optimizations.

The target (also known as objective) is the performance metric the optimizer uses to compare the backtest performance of different parameter values.

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

and then click .