Supported Models
QuantConnect Paper Trading
Introduction
This page explains the DefaultBrokerageModel
, including the asset classes it supports, its default security-level models, and it's default markets.
SetBrokerageModel(BrokerageName.QuantConnectBrokerage, AccountType.Cash); SetBrokerageModel(BrokerageName.QuantConnectBrokerage, AccountType.Margin); // Overrides the default account type
self.set_brokerage_model(BrokerageName.QUANTCONNECT_BROKERAGE) # Defaults to margin account self.set_brokerage_model(BrokerageName.QUANTCONNECT_BROKERAGE, AccountType.MARGIN) # Overrides the default account type
To view the implementation of this model, see the LEAN GitHub repository.
Asset Classes
The DefaultBrokerageModel
supports trading for all asset classes.
Orders
The following sections describe how the DefaultBrokerageModel
handles orders.
Order Types
The following table describes the available order types for each asset class that the DefaultBrokerageModel
supports:
Order Type | US Equity | Equity Options | Crypto | Crypto Futures | Forex | CFD | Futures | Futures Options | Index Options |
---|---|---|---|---|---|---|---|---|---|
Market | |||||||||
Limit | |||||||||
Limit if touched | |||||||||
Stop market | |||||||||
Stop limit | |||||||||
Market on open | |||||||||
Market on close | |||||||||
Combo market | |||||||||
Combo limit | |||||||||
Combo leg limit | |||||||||
Exercise Option | Not supported for cash-settled Options |
Time In Force
The DefaultBrokerageModel
supports the following TimeInForce instructions:
Day
DAY
GoodTilCanceled
good_til_canceled
GoodTilDate
good_til_date
Updates
The DefaultBrokerageModel
supports order updates.
Handling Splits
If you're using raw data normalization and you have active orders with a limit, stop, or trigger price in the market for a US Equity when a stock split occurs, the following properties of your orders automatically adjust to reflect the stock split:
- Quantity
- Limit price
- Stop price
- Trigger price
Fills
The following table shows the fill model that the DefaultBrokerageModel
uses for each SecurityType
:
SecurityType | Fill Model |
---|---|
Equity | EquityFillModel |
Future | FutureFillModel |
FutureOption | FutureOptionFillModel |
Remaining SecurityType values | ImmediateFillModel |
Slippage
The DefaultBrokerageModel
uses the NullSlippageModel.
Fees
The DefaultBrokerageModel
uses the ConstantFeeModel with no fees for Forex, CFD, Crypto, and Crypto Future assets and the InteractiveBrokersFeeModel for the remaining asset classes.
// For Forex, CFD, Crypto, and Crypto Future assets: security.SetFeeModel(new ConstantFeeModel(0.0m)); // For the remaining asset classes: security.SetFeeModel(new InteractiveBrokersFeeModel());
# For Forex, CFD, Crypto, and Crypto Future assets: security.set_fee_model(ConstantFeeModel(0)) # For the remaining asset classes: security.set_fee_model(InteractiveBrokersFeeModel())
Buying Power
The DefaultBrokerageModel
sets the buying power model based on the asset class of the security. The following table shows the default buying power model of each asset class:
Asset Class | Model |
---|---|
Equity Options | OptionMarginModel |
Futures | FutureMarginModel |
Future Options | FuturesOptionsMarginModel |
Index Options | OptionMarginModel |
Crypto | CashBuyingPowerModel for cash accounts or SecurityMarginModel for margin accounts |
CryptoFuture | CryptoFutureMarginModel |
Forex | CashBuyingPowerModel for cash accounts or SecurityMarginModel for margin accounts |
Other | SecurityMarginModel |
If you have a margin account, the DefaultBrokerageModel
allows 2x leverage for Equities, 50x leverage for Forex and CFDs, and 1x leverage for the remaining asset classes.
Settlement
The following table shows which settlement model the DefaultBrokerageModel
uses based on the security type and your account type:
Security Type | Account Type | Settlement Model |
---|---|---|
Equity | Cash | DelayedSettlementModel with the default settlement rules |
Option | Cash | DelayedSettlementModel with the default settlement rules |
Future | Any | FutureSettlementModel |
For all other cases, the DefaultBrokerageModel
uses the ImmediateSettlementModel.
// For US Equities with a cash account: security.SetSettlementModel(new DelayedSettlementModel(Equity.DefaultSettlementDays, Equity.DefaultSettlementTime)); // For Equity Options with a cash account: security.SetSettlementModel(new DelayedSettlementModel(Option.DefaultSettlementDays, Option.DefaultSettlementTime)); // For Futures security.SetSettlementModel(new FutureSettlementModel()); // For remaining cases: security.SetSettlementModel(new ImmediateSettlementModel());
# For US Equities with a cash account: security.set_settlement_model(DelayedSettlementModel(Equity.DEFAULT_SETTLEMENT_DAYS, Equity.DEFAULT_SETTLEMENT_TIME)) # For Equity Options with a cash account: security.set_settlement_model(DelayedSettlementModel(Option.DEFAULT_SETTLEMENT_DAYS, Option.DEFAULT_SETTLEMENT_TIME)) # For Futures security.set_settlement_model(FutureSettlementModel()) # For remaining cases: security.set_settlement_model(ImmediateSettlementModel())
Margin Interest Rate
The DefaultBrokerageModel
uses the NullMarginInterestRateModel.