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:
Argument | Data Type | Description | Default Value |
---|---|---|---|
fee | decimal float | The order fee quantity | |
currency | string str | The 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:
Argument | Data Type | Description | Default Value |
---|---|---|---|
monthlyForexTradeAmountInUSDollars | decimal float | Monthly Forex dollar volume traded | 0 |
monthlyOptionsTradeAmountInContracts | decimal float | Monthly Option contracts traded | 0 |
The following table describes which currency the InteractiveBrokersFeeModel
charges fees in for each asset class:
Asset Class | Fee Currency |
---|---|
US Equity | USD |
India Equity | INR |
Equity Options | USD |
Forex | USD |
US Futures | USD |
Hong Kong Futures | The contract quote currency (CNH, HKD, or USD) |
US Future Options | USD |
Hong Kong Future Options | The contract quote currency (CNH, HKD, or USD) |
Index Options | USD |
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:
Argument | Data Type | Description | Default Value |
---|---|---|---|
feesPerShare | decimal? float/NoneType | The fees per share to apply. If you don't provide a value, it uses 0.0035. | null None |
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:
Argument | Data Type | Description | Default Value |
---|---|---|---|
mFee | decimal float | Maker fee value | 0.001 |
tFee | decimal float | Taker fee value | 0.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.