# 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 concurrently run multiple backtests if you use multiple nodes, but the maximum number of nodes you can use depends on the node type. The following table describes the node types:

Type | Description | Number of Cores | RAM (GB) | Max Cluster Size |
---|---|---|---|---|

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

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

O8-16 | Complex strategies and machine learning | 8 | 16 | 4 |

The following table shows the training quotas of the optimization node types:

Type | 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 .