---
title: "Supported Models"
description: "This page describes the pre-built slippage models in LEAN. If none of these models perform exactly how you want, create a custom slippage model."
canonical: https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/slippage/supported-models
markdown: https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/slippage/supported-models.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/03%20Writing%20Algorithms/24%20Reality%20Modeling/03%20Slippage/02%20Supported%20Models
modified: 2026-10-30
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) > Reality Modeling > Slippage > 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 slippage models in LEAN. If none of these models perform exactly how you want, create a [custom slippage model](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/slippage/key-concepts.md#05-Model-Structure).

## Null Model

The `NullSlippageModel` sets the slippage of each order to zero. It's the default slippage model of the [DefaultBrokerageModel](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/quantconnect-paper-trading.md).

```python
security.set_slippage_model(NullSlippageModel.INSTANCE)
```

For more information about this model, see the [class reference](https://www.lean.io/docs/v2/lean-engine/class-reference/py/QuantConnect/Orders/Slippage/NullSlippageModel/) and [implementation](https://github.com/QuantConnect/Lean/blob/master/Common/Orders/Slippage/NullSlippageModel.cs).

## Constant Model

The `ConstantSlippageModel` applies a constant percentage of slippage to each order.

```python
security.set_slippage_model(ConstantSlippageModel(0.01))
```

The following table describes the arguments the model accepts:

| Argument | Data Type | Description | Default Value |
| --- | --- | --- | --- |
| `slippage_percent` | `float` | The slippage percent for each order. The value must be in the interval (0, 1). |  |

For more information about this model, see the [class reference](https://www.lean.io/docs/v2/lean-engine/class-reference/py/QuantConnect/Orders/Slippage/ConstantSlippageModel/) and [implementation](https://github.com/QuantConnect/Lean/blob/master/Common/Orders/Slippage/ConstantSlippageModel.cs).

## Volume Share Model

The `VolumeShareSlippageModel` calculates the slippage of each order by multiplying the price impact constant by the square of the ratio of the order to the total volume. If the volume of the current bar is zero, the slippage percent is

![Slippage percent calculation when bar volume is 0](https://cdn.quantconnect.com/i/tu/volume-share-case-1.png)

where *volumeLimit* and *priceImpact* are custom input variables. If the volume of the current bar is positive, the slippage percent is

![Slippage percent calculation when bar volume is greater than 0](https://cdn.quantconnect.com/i/tu/volume-share-case-2.png)

where *orderQuantity* is the quantity of the order and *barVolume* is the volume of the current bar. If the security subscription provides `TradeBar` data, the *barVolume* is the volume of the current bar. If the security subscription provides `QuoteBar` data, the *barVolume* is the bid or ask size of the current bar. CFD, Forex, and Crypto data often doesn't include volume. If there is no volume reported for these asset classes, the model returns zero slippage.

```python
security.set_slippage_model(VolumeShareSlippageModel())
```

The following table describes the arguments the model accepts:

| Argument | Data Type | Description | Default Value |
| --- | --- | --- | --- |
| `volume_limit` | `float` | Maximum percent of historical volume that can fill in each bar. 0.5 means 50% of historical volume. 1.0 means 100%. | 0.025 |
| `price_impact` | `float` | Scaling coefficient for price impact. Larger values will result in more simulated price impact. Smaller values will result in less simulated price impact. | 0.1 |

For more information about this model, see the [class reference](https://www.lean.io/docs/v2/lean-engine/class-reference/py/QuantConnect/Orders/Slippage/VolumeShareSlippageModel/) and [implementation](https://github.com/QuantConnect/Lean/blob/master/Common/Orders/Slippage/VolumeShareSlippageModel.cs).

## Market Impact Model

The `MarketImpactSlippageModel` calculates the slippage with perspective to the market impact created by an order, which mimics the consumption of the order book and disruption of the supply-demand relationship at the microeconomic scale. The model is divided into distinct parts, the market impact estimation and the slippage that results from it.

### Factors to Consider

The model includes factors that create market impact. [Almgren, Thum, Hauptmann & Li (2005)](https://www.cis.upenn.edu/~mkearns/finread/costestim.pdf) suggested the following factors:

1. Execution Time
   Asset price time series is usually considered as Random walk (with/without drift) $$S_t = S_{t-1} + f(S, t) + \epsilon$$ or Brownian Motion $$S_t = S_0 + exp((\mu-\frac{1}{2}\sigma^2)t + \sigma W_t)$$ In either model, the variance of predictions increases over time ($Var(S)=\sigma\sqrt{t}$). In fact, this happens to most stock price models. Thus, time uncertainty should also apply to the concept of slippage. The longer it takes to go from order submission to execution, the further the fill price will be from the price at order submission.
2. Volatility of the Underlying Securities
   Like (1), the volatility also contributes to the uncertainty of the next price ($Var(S)=\sigma\sqrt{t}$). In most cases, volatility has a one-sided impact since the market's volatility is often introduced by overbuying or overselling from positive or negative sentiments.
3. Liquidity
   Liquidity plays a crucial role in the supply-demand resilience. When a stock is liquid, an order usually only takes a small fraction of the market depth. Hence, the gap between the bid and ask price can be refilled quickly due to high market participation and a small gap. However, when a stock is illiquid, a single order might already take the top few layers of the order book, creating a wide gap between the bid and ask price and volume, which makes a bigger shift in the equilibrium price. This will create an impact which is permanent in nature.
   ![Market impact components](https://cdn.quantconnect.com/i/tu/market-impact-description.webp)
4. Order Size
   Last but not least, the order size directly affects the proportion of the order book/liquidity that the order consumes. Moreover, the larger the order is, the longer it takes to fill since the market might not have sufficient depth. This has interaction effects with the preceding factors.

### Market Impact Decomposition

In the book ["A Signal Processing Perspective on Financial Engineering", Feng & Palomer (2015)](https://palomar.home.ece.ust.hk/papers/2016/Feng&Palomar-FnT2016.pdf) generalized scholars' opinions that market impact can be broken down into "permanent" and "temporary" components, with noise. The permanent impact of a trade refers to the price differences between equilibrium prices before and after the trade and the resilience of the order book. In contrast, temporary impact refers to the price difference between the instant price drop after a trade and the post-trade equilibrium.

![Market impact under different liquidity situation](https://cdn.quantconnect.com/i/tu/market-impact-liquidity.webp)

The model incorporates the preceding factors and estimates both the permanent and temporary impact components with two diffusion models as a function of $\nu=\frac{X}{VT}$, which is the normalized order size: $$G\left(\nu\right)=\pm\gamma\left|\nu\right|^\alpha+\text{noise}$$ $$H\left(\nu\right)=\pm\eta\left|\nu\right|^\beta+\text{noise}$$ where $X$ is the order quantity, $V$ is the average daily volume, and $T$ is the time difference between order submission and filling (execution time). The other symbols are parameters that are calibrated from historical trade data. Together with the execution time, daily volatility $\sigma$, and liquidity factor $\delta$, the complete models are as follows: $$I=\sigma T \gamma\left|\frac{X}{VT}\right|^\alpha\left(\frac{\Theta}{V}\right)^\delta+\sigma\sqrt{T_{\text{post}}}\epsilon$$ $$J=\sigma T \eta\left|\frac{X}{VT}\right|^\beta+\sigma\sqrt{T_{\text{post}}}\epsilon$$ where $\Theta$ is the share outstanding, $T_{post}$ is the time difference between order submission and the new equilibrium established, $I$ is the permanent market impact, and $J$ is the temporary market impact. The inverse of the turnover rate $\frac{\Theta}{V}$ contributes to the permanent impact. This relationship is reasonable since higher turnover means more market participants are in the market, so the order book depth is deeper.

### Implementation

```python
security.set_slippage_model(MarketImpactSlippageModel(self))
```

The following table describes the arguments the model accepts:

| Argument | Data Type | Description | Default Value |
| --- | --- | --- | --- |
| `algorithm` | `IAlgorithm` | The algorithm instance |  |
| `non_negative` | `bool` | Indicator whether only non-negative slippage allowed. | `True` |
| `latency` | `float` | Seconds between order submission and order fill | 0.075 |
| `impact_time` | `float` | Seconds between order fill and the establishment of the new equilibrium | 1800 |
| `alpha` | `float` | Exponent of the permanent impact function | 0.891 |
| `beta` | `float` | Exponent of the temporary impact function | 0.600 |
| `gamma` | `float` | Coefficient of the permanent impact function | 0.314 |
| `eta` | `float` | Coefficient of the temporary impact function | 0.142 |
| `delta` | `float` | Liquidity scaling factor for permanent impact | 0.267 |
| `random_seed` | `int` | Random seed for generating gaussian noise | 50 |

The default parameters of the `MarketImpactSlippageModel` are the parameters that the authors calibrated and shared. However, you may want to reference the original paper and recalibrate the parameters because of the following reasons:

- The default parameters are calibrated around 2 decades ago
- The trading time effect is not accounted (volume near market open/close is larger)
- The market environment does not have many market makers at that time

For more information about this model, see the [class reference](https://www.lean.io/docs/v2/lean-engine/class-reference/py/QuantConnect/Orders/Slippage/MarketImpactSlippageModel/) and [implementation](https://github.com/QuantConnect/Lean/blob/master/Common/Orders/Slippage/MarketImpactSlippageModel.cs).
