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 TypeUS EquityEquity OptionsCryptoCrypto FuturesForexCFDFuturesFutures OptionsIndex Options
Marketgreen checkgreen checkgreen checkgreen checkgreen checkgreen checkgreen checkgreen checkgreen check
Limitgreen checkgreen checkgreen checkgreen checkgreen checkgreen checkgreen checkgreen checkgreen check
Limit if touchedgreen checkgreen checkgreen checkgreen checkgreen checkgreen checkgreen checkgreen checkgreen check
Stop marketgreen checkgreen checkgreen checkgreen checkgreen checkgreen checkgreen checkgreen checkgreen check
Stop limitgreen checkgreen checkgreen checkgreen checkgreen checkgreen checkgreen checkgreen checkgreen check
Market on opengreen checkgreen checkgreen checkgreen checkgreen checkgreen check
Market on closegreen checkgreen checkgreen checkgreen checkgreen checkgreen checkgreen checkgreen check
Combo marketgreen checkgreen checkgreen check
Combo limitgreen checkgreen checkgreen check
Combo leg limitgreen checkgreen checkgreen check
Exercise Optiongreen check
Not supported for cash-settled Options
green check

Time In Force

The DefaultBrokerageModel supports the following TimeInForce instructions:

  • DayDAY
  • GoodTilCanceledgood_til_canceled
  • GoodTilDategood_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:

SecurityTypeFill Model
EquityEquityFillModel
FutureFutureFillModel
FutureOptionFutureOptionFillModel
Remaining SecurityType valuesImmediateFillModel

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 ClassModel
Equity OptionsOptionMarginModel
FuturesFutureMarginModel
Future OptionsFuturesOptionsMarginModel
Index OptionsOptionMarginModel
CryptoCashBuyingPowerModel for cash accounts or SecurityMarginModel for margin accounts
CryptoFutureCryptoFutureMarginModel
ForexCashBuyingPowerModel for cash accounts or SecurityMarginModel for margin accounts
OtherSecurityMarginModel

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 TypeAccount TypeSettlement Model
EquityCashDelayedSettlementModel with the default settlement rules
OptionCashDelayedSettlementModel with the default settlement rules
FutureAnyFutureSettlementModel

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.

Default Markets

The following table describes the default markets of each SecurityType for the DefaultBrokerageModel:

SecurityTypeMarket
EquityUSA
OptionUSA
FutureCME
FutureOptionCME
IndexUSA
IndexOptionUSA
ForexOanda
CfdOanda
CryptoCoinbase
CryptoFutureBinance

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: