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

## Null Model

The `NullMarginInterestRateModel` doesn't charge any margin interest. It's the default margin interest rate of the [DefaultBrokerageModel](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/quantconnect-paper-trading.md).

```python
security.margin_interest_rate_model = MarginInterestRateModel.NULL
```

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

## Short Equity Model

The `ShortMarginInterestRateModel` simulates the margin cost and payments of your Equity holdings. This model use the fee rate to compute the amount due to borrowing the asset to short, and the rebate rate to compute the amount due to lending the asset for shorting. For more information about these rates providers, see [Short Availability](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/short-availability/key-concepts.md).

```python
security.set_shortable_provider(InteractiveBrokersShortableProvider())
security.margin_interest_rate_model = ShortMarginInterestRateModel()
```

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

## Binance Futures Model

The `BinanceFutureMarginInterestRateModel` simulates the margin cost and payments of your Crypto Future holdings. When the funding rate is positive, the price of the perpetual contract is higher than the mark price, so traders who are long pay for short positions. Conversely, a negative funding rate indicates that perpetual prices are below the mark price, so traders who are short pay for long positions. The interest amount is

$$ Nominal \ Value \ of \ Positions * Funding \ Rate $$

The interest amount is periodically credited or debited from your currency holdings while you hold open positions. The interest amount is charged at 12 AM, 8 AM, 4 PM in your [algorithm time zone](https://www.quantconnect.com/docs/v2/writing-algorithms/key-concepts/time-modeling/time-zones.md#04-Algorithm-Time-Zone).

```python
security.margin_interest_rate_model = BinanceFutureMarginInterestRateModel()
```

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

## Bybit Futures Model

The `BybitFutureMarginInterestRateModel` has the same behavior as the [BinanceFutureMarginInterestRateModel](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/margin-interest-rate/supported-models.md#04-Binance-Futures-Model).

```python
security.margin_interest_rate_model = BybitFutureMarginInterestRateModel()
```

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

## dYdX Futures Model

The `dYdXFutureMarginInterestRateModel` simulates the margin cost and payments of your Crypto Future holdings. When the funding rate is positive, the price of the perpetual contract is higher than the mark price, so traders who are long pay for short positions. Conversely, a negative funding rate indicates that perpetual prices are below the mark price, so traders who are short pay for long positions. The interest amount is

$$ Nominal \ Value \ of \ Positions * Funding \ Rate $$

The interest amount is periodically credited or debited from your currency holdings while you hold open positions. The interest amount is charged at 12 AM, 8 AM, and 4 PM in your [algorithm time zone](https://www.quantconnect.com/docs/v2/writing-algorithms/key-concepts/time-modeling/time-zones.md#04-Algorithm-Time-Zone).

```python
security.margin_interest_rate_model = dYdXFutureMarginInterestRateModel()
```

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