---
title: "Optimization Analysis"
description: "Learn how to analyze optimization results in the Research Environment."
canonical: https://www.quantconnect.com/docs/v2/research-environment/meta-analysis/optimization-analysis
markdown: https://www.quantconnect.com/docs/v2/research-environment/meta-analysis/optimization-analysis.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/04%20Research%20Environment/10%20Meta%20Analysis/03%20Optimization%20Analysis
modified: 2026-10-28
index: https://www.quantconnect.com/llms.txt
---

# Optimization Analysis

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Research Environment](https://www.quantconnect.com/docs/v2/research-environment.md) > Meta Analysis > Optimization Analysis

> Code examples are shown in Python. Append `?lang=csharp` to this URL for the C# version of this page.

## Introduction

Load your optimization results into the Research Environment to analyze how different combinations of parameters affect the algorithm's performance.

## Read Optimization Results

To get the results of an optimization, call the `read_optimization` method with the optimization Id.

```python
optimization = api.read_optimization(optimization_id)
```

The following table provides links to documentation that explains how to get the optimization Id, depending on the platform you use:

| Platform | Optimization Id |
| --- | --- |
| Cloud Platform | [Get Optimization Id](https://www.quantconnect.com/docs/v2/cloud-platform/optimization/getting-started.md#06-Get-Optimization-Id) |
| Local Platform | [Get Optimization Id](https://www.quantconnect.com/docs/v2/local-platform/optimization/getting-started.md#07-Get-Optimization-Id) |
| CLI |  |

The `read_optimization` method returns an `Optimization` object, which have the following attributes:

*Members of `QuantConnect.Api.Optimization` (JSON): https://www.quantconnect.com/services/inspector?type=T:QuantConnect.Api.Optimization&language=python*

## Example

### Example 1: Read Optimization Results

The following example reads the last completed optimization job and obtains the optimum paramteters in a jupyter notebook.

```python
# Instantiate QuantBook instance for researching.
qb = QuantBook()

# Get optimization job list in the current project.
optimizations = api.list_optimizations(qb.project_id)
# Get the last completed optimizations to study.
optimization_id = sorted(
    [x for x in optimizations if x.status == OptimizationStatus.COMPLETED],
    key=lambda x: x.created,
    reverse=True
)[0].optimization_id
optimization = api.read_optimization(optimization_id)

# Obtain the backtest with the best Sharpe Ratio.
best_backtest = max(optimization.backtests.values(), key=lambda x: x.statistics["SharpeRatio"])
# Obtain the parameter set of the backtest with the best result.
parameter_set = best_backtest.parameter_set
print(parameter_set)
```
