Supported Models

TD Ameritrade


This page explains TDAmeritradeBrokerageModel, including the asset classes it supports, its default security-level models, and it's default markets.

SetBrokerageModel(BrokerageName.TDAmeritrade, AccountType.Cash);
SetBrokerageModel(BrokerageName.TDAmeritrade, AccountType.Margin);
self.SetBrokerageModel(BrokerageName.TDAmeritrade, AccountType.Cash)
self.SetBrokerageModel(BrokerageName.TDAmeritrade, AccountType.Margin)

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

Asset Classes

The TDAmeritradeBrokerageModel supports trading US Equities.


The TDAmeritradeBrokerageModel supports several order types, order properties, and order updates.

Order Types

The following table describes the available order types for each asset class that the TDAmeritradeBrokerageModel supports:

Order TypeEquity
MarketOrdergreen check
LimitOrdergreen check
StopMarketOrdergreen check
StopLimitOrdergreen check

Time In Force

The TDAmeritradeBrokerageModel supports the following TimeInForce instructions:

  • Day
  • GoodTilCanceled
  • GoodTilDate
public override void Initialize()
    // Set the default order properties
    DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled;

public override void OnData(Slice slice)
    // Use default order order properties
    LimitOrder(_symbol, quantity, limitPrice);
    // Override the default order properties
    LimitOrder(_symbol, quantity, limitPrice, 
               orderProperties: new TDAmeritradeOrderProperties
                   TimeInForce = TimeInForce.Day
    LimitOrder(_symbol, quantity, limitPrice, 
               orderProperties: new TDAmeritradeOrderProperties
                   TimeInForce = TimeInForce.GoodTilDate(new DateTime(year, month, day))
def Initialize(self) -> None:
    # Set the default order properties
    self.DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled

def OnData(self, slice: Slice) -> None:
    # Use default order order properties
    self.LimitOrder(self.symbol, quantity, limit_price)
    # Override the default order properties
    order_properties = TDAmeritradeOrderProperties()
    order_properties.TimeInForce = TimeInForce.Day
    self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)

    order_properties.TimeInForce = TimeInForce.GoodTilDate(datetime(year, month, day))
    self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)


The TDAmeritradeBrokerageModel 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


The TDAmeritradeBrokerageModel uses the EquityFillModel.


The TDAmeritradeBrokerageModel uses the ConstantSlippageModel with zero slippage.

security.SetSlippageModel(new ConstantSlippageModel(0));


The TDAmeritradeBrokerageModel uses the TDAmeritradeFeeModel.

Buying Power

The TDAmeritradeBrokerageModel uses the SecurityMarginModel. If you have a margin account, the TDAmeritradeBrokerageModel allows up to 2x leverage.


The TDAmeritradeBrokerageModel uses the ImmediateSettlementModel for margin accounts and the DelayedSettlementModel with the default settlement rules for cash accounts.

// For cash accounts:
security.SettlementModel = new DelayedSettlementModel(Equity.DefaultSettlementDays, Equity.DefaultSettlementTime);

// For margin accounts:
security.SettlementModel = new ImmediateSettlementModel();
# For cash accounts:
security.SettlementModel = DelayedSettlementModel(Equity.DefaultSettlementDays, Equity.DefaultSettlementTime)

# For margin accounts:
security.SettlementModel = ImmediateSettlementModel()

Margin Interest Rate

The TDAmeritradeBrokerageModel uses the NullMarginInterestRateModel.

Default Markets

The default market of the TDAmeritradeBrokerageModel is Market.USA.

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: