Transaction Fees

Supported Models

Introduction

This page describes some of the pre-built fee models in LEAN. For more brokerage-specific fee models, see the brokerage integration documentation pages. If none of these models perform exactly how you want, create a custom fee model.

Constant Model

The ConstantFeeModel applies a constant fee to each order. It's the default fee model of the DefaultBrokerageModel if you trade Forex, CFD, or Crypto assets.

security.SetFeeModel(new ConstantFeeModel(0.05m));
security.SetFeeModel(ConstantFeeModel(0.05))

The following table describes the arguments the model accepts:

ArgumentData TypeDescriptionDefault Value
feedecimalfloatThe order fee quantity
currencystringstrThe order fee currency
"USD"

To view the implementation of this model, see the LEAN GitHub repository.

Interactive Brokers Model

The InteractiveBrokersFeeModel models the fees of Interactive Brokers. It's the default fee model of the DefaultBrokerageModel if you trade Equity, Option, Future, or Future Options assets.

security.SetFeeModel(new InteractiveBrokersFeeModel());
security.SetFeeModel(InteractiveBrokersFeeModel())

The following table describes the arguments the model accepts:

ArgumentData TypeDescriptionDefault Value
monthlyForexTradeAmountInUSDollarsdecimalfloatMonthly Forex dollar volume traded0
monthlyOptionsTradeAmountInContractsdecimalfloatMonthly Option contracts traded
0

To view the implementation of this model, see the LEAN GitHub repository.

Atreyu Model

The AtreyuFeeModel models the fees of Atreyu Trading. It's the default fee model of the AtreyuBrokerageModel.

security.SetFeeModel(new AtreyuFeeModel());
security.SetFeeModel(AtreyuFeeModel())

The following table describes the arguments the model accepts:

ArgumentData TypeDescriptionDefault Value
feesPerSharedecimal?float/NoneTypeThe fees per share to apply. If you don't provide a value, it uses 0.0035.nullNone

To view the implementation of this model, see the LEAN GitHub repository.

Binance Model

The BinanceFeeModel models the fees of Binance and Binance US. It's the default fee model of the BinanceBrokerageModel and BinanceUSBrokerageModel.

security.SetFeeModel(new BinanceFeeModel());
security.SetFeeModel(BinanceFeeModel())

The following table describes the arguments the model accepts:

ArgumentData TypeDescriptionDefault Value
mFeedecimalfloatMaker fee value0.001
tFeedecimalfloatTaker fee value0.001

To view the implementation of this model, see the LEAN GitHub repository.

Bitfinex Model

The BitfinexFeeModel models the fees of Bitfinex. It's the default fee model of the BitfinexBrokerageModel.

security.SetFeeModel(new BitfinexFeeModel());
security.SetFeeModel(BitfinexFeeModel())

To view the implementation of this model, see the LEAN GitHub repository.

FTX Model

The FTXFeeModel models the fees of FTX. It's the default fee model of the FTXBrokerageModel.

security.SetFeeModel(new FTXFeeModel());
security.SetFeeModel(FTXFeeModel())

To view the implementation of this model, see the LEAN GitHub repository.

FTX US Model

The FTXUSFeeModel models the fees of FTX. It's the default fee model of the FTXUSBrokerageModel.

security.SetFeeModel(new FTXUSFeeModel());
security.SetFeeModel(FTXUSFeeModel())

To view the implementation of this model, see the LEAN GitHub repository.

GDAX Model

The GDAXFeeModel models the fees of Coinbase Pro. It's the default fee model of the GDAXBrokerageModel.

security.SetFeeModel(new GDAXFeeModel());
security.SetFeeModel(GDAXFeeModel())

To view the implementation of this model, see the LEAN GitHub repository.

Kraken Model

The KrakenFeeModel models the fees of Kraken. It's the default fee model of the KrakenBrokerageModel.

security.SetFeeModel(new KrakenFeeModel());
security.SetFeeModel(KrakenFeeModel())

To view the implementation of this model, see the LEAN GitHub repository.

Samco Model

The SamcoFeeModel models the fees of Samco. It's the default fee model of the SamcoBrokerageModel.

security.SetFeeModel(new SamcoFeeModel());
security.SetFeeModel(SamcoFeeModel())

To view the implementation of this model, see the LEAN GitHub repository.

Zerodha Model

The ZerodhaFeeModel models the fees of Zerodah. It's the default fee model of the ZerodhaBrokerageModel.

security.SetFeeModel(new ZerodhaFeeModel());
security.SetFeeModel(ZerodhaFeeModel())

To view the implementation of this model, see the LEAN GitHub repository.

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: