Quant League is evolving into Strategies, our new home for sharing, discovering, and exploring trading strategies, with improved organization and a better overall experience. Q4-2025 will be the final Quant League.
LEAN is the open-source algorithmic trading engine powering QuantConnect.
Founded in 2012 LEAN has been built by a global community of 180+ engineers and powers more than 300+ hedge funds today.
Join Our Discord Channel
Join QuantConnect's Discord server for real-time support, where a vibrant community of traders and developers awaits to help you with any of your QuantConnect needs.
This research is under review. To publish this research attract three community upvotes.
This research is under review. To publish this research attract three community upvotes.
This discussion is a draft. Click here to publish this discusison.
Interactive Brokers fee structure
Hi,
Has anyone noticed, it seems like the IB fee model is out of date. Max fee per order should be 1% of trade value but the QC implementation is 0.5% (Fixed, US Equities)
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Mia Alissi
STAFF Pro
,
Here’s an approach and code example you can use to address Dat's concern about the Interactive Brokers fee model in QuantConnect:
Issue Clarification
As per Dat and Interactive Brokers’ published rates, the maximum fee for US equity orders should be 1% of trade value (not 0.5%) for the fixed commission model.
QuantConnect's default InteractiveBrokersFeeModel may still cap at 0.5%.
Solution
You can create a custom fee model that:
Charges $0.005 per share.
Has a $1.00 minimum fee per order.
Caps fees at 1% of the order’s gross trade value.
Here’s a simple example of how you could code and assign this custom fee model:
from AlgorithmImports import *
class CustomInteractiveBrokersFeeModel(FeeModel):
def get_order_fee(self, parameters: OrderFeeParameters) -> OrderFee:
security = parameters.security
order = parameters.order
# Avoid zero-price or zero-quantity situations
if security.price <= 0 or order.absolute_quantity == 0:
return OrderFee(CashAmount(0, "USD"))
trade_value = security.price * order.absolute_quantity
fee_per_share = 0.005
minimum_fee = 1.0
maximum_fee_rate = 0.01 # 1% of trade value
fee = order.absolute_quantity * fee_per_share
# Enforce minimum fee
if fee < minimum_fee:
fee = minimum_fee
# Enforce maximum fee
max_fee = trade_value * maximum_fee_rate
if fee > max_fee:
fee = max_fee
return OrderFee(CashAmount(fee, "USD"))
class CustomInteractiveBrokersFeeModelAlgorithm(QCAlgorithm):
def initialize(self) -> None:
self.set_start_date(2021, 1, 1)
self.set_end_date(2022, 1, 1)
self.set_cash(100000)
self._symbol = self.add_equity("SPY", Resolution.DAILY).symbol
self.securities[self._symbol].fee_model = CustomInteractiveBrokersFeeModel()
def on_data(self, data: Slice) -> None:
if not self.portfolio.invested:
self.market_order(self._symbol, 10)
Regarding IB Tiered Pricing Model
As of now, QuantConnect does not offer out-of-the-box native support for the IBKR tiered commission scheme. Only the fixed model is implemented.
For a tiered model, you’d need to design a more sophisticated custom FeeModel, implementing the different tiers and thresholds as published on the IB website.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp. You can
continue your Boot Camp training progress from the terminal. We
hope to see you in the community soon!
Allocate to this Strategy
Institutional clients can contact the author and allocate capital to this strategy.
Mia Alissi
Here’s an approach and code example you can use to address Dat's concern about the Interactive Brokers fee model in QuantConnect:
Issue Clarification
InteractiveBrokersFeeModelmay still cap at 0.5%.Solution
You can create a custom fee model that:
Here’s a simple example of how you could code and assign this custom fee model:
Regarding IB Tiered Pricing Model
References:
Let me know if you want a working example with the tiered structure!
Sources: Brokerage Model Algorithm, Custom Models Algorithm, Custom Models P E P8 Algorithm, Micro Study: Yen Carry Trade, Opening Range Breakout for Stocks in Play
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Dat En
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!