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 the absolute value of 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

The following table describes which currency the InteractiveBrokersFeeModel charges fees in for each asset class:

Asset ClassFee Currency
US EquityUSD
India EquityINR
Equity OptionsUSD
ForexUSD
US FuturesUSD
Hong Kong FuturesThe contract quote currency (CNH, HKD, or USD)
US Future OptionsUSD
Hong Kong Future OptionsThe contract quote currency (CNH, HKD, or USD)
Index OptionsUSD

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

The AtreyuFeeModel charges fees in USD.

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

The BinanceFeeModel charges fees in the currency you receive from a trade. For example, if you buy ETHBTC, you pay fees in ETH. If you sell ETHBTC, you pay fees in BTC.

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())

The BitfinexFeeModel charges fees in the currency you receive from a trade. For example, if you buy ETHBTC, you pay fees in ETH. If you sell ETHBTC, you pay fees in BTC.

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

GDAX Model

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

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

The GDAXFeeModel charges fees in the quote currency.

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())

The KrakenFeeModel charges fees in the quote currency for buy orders and in the base currency for sell orders. To override these settings, define the KrakenOrderProperties.

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())

The SamcoFeeModel charges fees in INR.

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

TD Ameritrade Model

The TDAmeritradeFeeModel models the fees of TD Ameritrade. It's the default fee model of the TDAmeritradeBrokerageModel.

security.SetFeeModel(new TDAmeritradeFeeModel());
security.SetFeeModel(TDAmeritradeFeeModel())

The TDAmeritradeFeeModel charges fees in USD.

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

Wolverine Model

The WolverineFeeModel models the fees of Wolverine Execution Services. It's the default fee model of the WolverineBrokerageModel.

security.SetFeeModel(new WolverineFeeModel());
security.SetFeeModel(WolverineFeeModel())

The WolverineFeeModel charges fees in USD.

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

Zerodha Model

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

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

The ZerodhaFeeModel charges fees in INR.

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: