---
title: "Supported Models"
description: "This page describes the pre-built Execution models in LEAN. If none of these models perform exactly how you want, create a custom Execution model."
canonical: https://www.quantconnect.com/docs/v2/writing-algorithms/algorithm-framework/execution/supported-models
markdown: https://www.quantconnect.com/docs/v2/writing-algorithms/algorithm-framework/execution/supported-models.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/03%20Writing%20Algorithms/34%20Algorithm%20Framework/06%20Execution/02%20Supported%20Models
modified: 2026-10-28
index: https://www.quantconnect.com/llms.txt
---

# Supported Models

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Writing Algorithms](https://www.quantconnect.com/docs/v2/writing-algorithms.md) > Algorithm Framework > Execution > Supported Models

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

## Introduction

This page describes the pre-built Execution models in LEAN. The number of models grows over time. To add a model to LEAN, make a pull request to the [GitHub repository](https://github.com/QuantConnect/Lean/tree/master/Algorithm.Framework/Execution). If none of these models perform exactly how you want, create a [custom Execution model](https://www.quantconnect.com/docs/v2/writing-algorithms/algorithm-framework/execution/key-concepts.md#03-Model-Structure).

## Null Model

The `NullExecutionModel` doesn't place any trades.

```python
# Set the execution model to NullExecutionModel, which disables execution functionality for debugging or when the execution logic is not needed for the current strategy.
self.set_execution(NullExecutionModel())
```

For more information about this model, see the [class reference](https://www.lean.io/docs/v2/lean-engine/class-reference/py/QuantConnect/Algorithm/Framework/Execution/NullExecutionModel/) and [implementation](https://github.com/QuantConnect/Lean/blob/master/Algorithm/Execution/NullExecutionModel.py).

## Immediate Model

The `ImmediateExecutionModel` is the default Execution model. It uses market orders to immediately fill portfolio targets. It's similar to placing market orders in line with your algorithm logic.

```python
# Use ImmediateExecutionModel for executing trades instantly at market price to minimize execution delay. This may incur extra slippage.
self.set_execution(ImmediateExecutionModel())
```

For more information about this model, see the [class reference](https://www.lean.io/docs/v2/lean-engine/class-reference/py/QuantConnect/Algorithm/Framework/Execution/ImmediateExecutionModel/) and [implementation](https://github.com/QuantConnect/Lean/blob/master/Algorithm/Execution/ImmediateExecutionModel.py).

## Spread Model

The `SpreadExecutionModel` executes trades with market orders if the exchange is open and the bid-ask spread is within a threshold percentage. The model only works if the security subscription provides QuoteBar data. The spread percentage is calculated as

$$ \frac{a - b}{p} $$

where $a$ is the ask price, $b$ is the bid price, and $p$ is the price.

```python
# Use SpreadExecutionModel to manage trade execution based on bid-ask spreads, aiming to optimize trade execution costs and reduce slippage.
self.set_execution(SpreadExecutionModel())
```

The following table describes the arguments the model accepts:

| Argument | Data Type | Description | Default Value |
| --- | --- | --- | --- |
| `accepting_spread_percent` | `float` | Maximum spread accepted comparing to current price in percentage | 0.005 (0.5%) |

For more information about this model, see the [class reference](https://www.lean.io/docs/v2/lean-engine/class-reference/py/QuantConnect/Algorithm/Framework/Execution/SpreadExecutionModel/) and [implementation](https://github.com/QuantConnect/Lean/blob/master/Algorithm.Framework/Execution/SpreadExecutionModel.py).

## Standard Deviation Model

The `StandardDeviationExecutionModel` seeks to fill orders when the price is more than 2 standard deviations lower than the average price over a trailing period. The intent is to find dips in the market to place trades. In strongly trending markets, this procedure can result in delayed trade placement since it might be a while before the next price spike or dip.

```python
# Use StandardDeviationExecutionModel to execute trades based on volatility measures, aiming to adapt trade sizes and timing according to market volatility.
self.set_execution(StandardDeviationExecutionModel())
```

The following table describes the arguments the model accepts:

| Argument | Data Type | Description | Default Value |
| --- | --- | --- | --- |
| `period` | `float` | Period of the standard deviation indicator | 60 |
| `deviations` | `int` | The number of deviations away from the mean before submitting an order | 2 |
| `resolution` | `Resolution` | The resolution of the STD and SMA indicators | `Resolution.MINUTE` |

For more information about this model, see the [class reference](https://www.lean.io/docs/v2/lean-engine/class-reference/py/QuantConnect/Algorithm/Framework/Execution/StandardDeviationExecutionModel/) and [implementation](https://github.com/QuantConnect/Lean/blob/master/Algorithm.Framework/Execution/StandardDeviationExecutionModel.py).

## VWAP Model

The `VolumeWeightedAveragePriceExecutionModel` works to fill your orders at or better than the volume-weighted average price (VWAP) for the trading day. This is a best-effort algorithm, so no guarantee can be made that it will reach the VWAP.

![VWAP execution model implementation](https://cdn.quantconnect.com/web/i/docs/algorithm-framework/execution-model-vwap-fill.png)

*VWAP Execution Model Fill Placements*

The model uses market orders and it only works if the security subscription provides intraday data. It sets a maximum order size of 1% of the current bar's volume, but you can update the maximum order size through the `maximum_order_quantity_percent_volume` member.

```python
# Use VolumeWeightedAveragePriceExecutionModel to execute trades based on volume-weighted average price, aiming to minimize market impact and achieve better execution prices.
self.set_execution(VolumeWeightedAveragePriceExecutionModel())
```

For more information about this model, see the [class reference](https://www.lean.io/docs/v2/lean-engine/class-reference/py/QuantConnect/Algorithm/Framework/Execution/VolumeWeightedAveragePriceExecutionModel/) and [implementation](https://github.com/QuantConnect/Lean/blob/master/Algorithm.Framework/Execution/VolumeWeightedAveragePriceExecutionModel.py).
