Lean  $LEAN_TAG$
QuantConnect.Securities.PatternDayTradingMarginModel Class Reference

Represents a simple margining model where margin/leverage depends on market state (open or close). During regular market hours, leverage is 4x, otherwise 2x More...

Inheritance diagram for QuantConnect.Securities.PatternDayTradingMarginModel:
[legend]

Public Member Functions

 PatternDayTradingMarginModel ()
 Initializes a new instance of the PatternDayTradingMarginModel More...
 
 PatternDayTradingMarginModel (decimal closedMarketLeverage, decimal openMarketLeverage)
 Initializes a new instance of the PatternDayTradingMarginModel More...
 
override void SetLeverage (Security security, decimal leverage)
 Sets the leverage for the applicable securities, i.e, equities More...
 
override decimal GetLeverage (Security security)
 Gets the current leverage of the security More...
 
override InitialMargin GetInitialMarginRequirement (InitialMarginParameters parameters)
 The percentage of an order's absolute cost that must be held in free cash in order to place the order More...
 
override MaintenanceMargin GetMaintenanceMargin (MaintenanceMarginParameters parameters)
 The percentage of the holding's absolute cost that must be held in free cash in order to avoid a margin call More...
 
- Public Member Functions inherited from QuantConnect.Securities.SecurityMarginModel
 SecurityMarginModel ()
 Initializes a new instance of the SecurityMarginModel with no leverage (1x) More...
 
 SecurityMarginModel (decimal initialMarginRequirement, decimal maintenanceMarginRequirement, decimal requiredFreeBuyingPowerPercent)
 Initializes a new instance of the SecurityMarginModel More...
 
 SecurityMarginModel (decimal leverage, decimal requiredFreeBuyingPowerPercent=0)
 Initializes a new instance of the SecurityMarginModel More...
 
- Public Member Functions inherited from QuantConnect.Securities.BuyingPowerModel
 BuyingPowerModel ()
 Initializes a new instance of the BuyingPowerModel with no leverage (1x) More...
 
 BuyingPowerModel (decimal initialMarginRequirement, decimal maintenanceMarginRequirement, decimal requiredFreeBuyingPowerPercent)
 Initializes a new instance of the BuyingPowerModel More...
 
 BuyingPowerModel (decimal leverage, decimal requiredFreeBuyingPowerPercent=0)
 Initializes a new instance of the BuyingPowerModel More...
 
virtual InitialMargin GetInitialMarginRequiredForOrder (InitialMarginRequiredForOrderParameters parameters)
 Gets the total margin required to execute the specified order in units of the account currency including fees More...
 
virtual HasSufficientBuyingPowerForOrderResult HasSufficientBuyingPowerForOrder (HasSufficientBuyingPowerForOrderParameters parameters)
 Check if there is sufficient buying power to execute this order. More...
 
virtual GetMaximumOrderQuantityResult GetMaximumOrderQuantityForDeltaBuyingPower (GetMaximumOrderQuantityForDeltaBuyingPowerParameters parameters)
 Get the maximum market order quantity to obtain a delta in the buying power used by a security. The deltas sign defines the position side to apply it to, positive long, negative short. More...
 
virtual GetMaximumOrderQuantityResult GetMaximumOrderQuantityForTargetBuyingPower (GetMaximumOrderQuantityForTargetBuyingPowerParameters parameters)
 Get the maximum market order quantity to obtain a position with a given buying power percentage. Will not take into account free buying power. More...
 
decimal GetAmountToOrder ([NotNull]Security security, decimal targetMargin, decimal marginForOneUnit, out decimal finalMargin)
 Helper function that determines the amount to order to get to a given target safely. Meaning it will either be at or just below target always. More...
 
virtual ReservedBuyingPowerForPosition GetReservedBuyingPowerForPosition (ReservedBuyingPowerForPositionParameters parameters)
 Gets the amount of buying power reserved to maintain the specified position More...
 
virtual BuyingPower GetBuyingPower (BuyingPowerParameters parameters)
 Gets the buying power available for a trade More...
 

Additional Inherited Members

- Static Public Attributes inherited from QuantConnect.Securities.BuyingPowerModel
static readonly IBuyingPowerModel Null = new NullBuyingPowerModel()
 Gets an implementation of IBuyingPowerModel that does not check for sufficient buying power More...
 
- Protected Member Functions inherited from QuantConnect.Securities.BuyingPowerModel
virtual decimal GetMarginRemaining (SecurityPortfolioManager portfolio, Security security, OrderDirection direction)
 Gets the margin cash available for a trade More...
 
- Protected Attributes inherited from QuantConnect.Securities.BuyingPowerModel
decimal RequiredFreeBuyingPowerPercent
 The percentage used to determine the required unused buying power for the account. More...
 

Detailed Description

Represents a simple margining model where margin/leverage depends on market state (open or close). During regular market hours, leverage is 4x, otherwise 2x

Definition at line 22 of file PatternDayTradingMarginModel.cs.

Constructor & Destructor Documentation

◆ PatternDayTradingMarginModel() [1/2]

QuantConnect.Securities.PatternDayTradingMarginModel.PatternDayTradingMarginModel ( )

Initializes a new instance of the PatternDayTradingMarginModel

Definition at line 29 of file PatternDayTradingMarginModel.cs.

◆ PatternDayTradingMarginModel() [2/2]

QuantConnect.Securities.PatternDayTradingMarginModel.PatternDayTradingMarginModel ( decimal  closedMarketLeverage,
decimal  openMarketLeverage 
)

Initializes a new instance of the PatternDayTradingMarginModel

Parameters
closedMarketLeverageLeverage used outside regular market hours
openMarketLeverageLeverage used during regular market hours

Definition at line 39 of file PatternDayTradingMarginModel.cs.

Member Function Documentation

◆ SetLeverage()

override void QuantConnect.Securities.PatternDayTradingMarginModel.SetLeverage ( Security  security,
decimal  leverage 
)
virtual

Sets the leverage for the applicable securities, i.e, equities

Do nothing, we use a constant leverage for this model

Parameters
securityThe security to set leverage to
leverageThe new leverage

Reimplemented from QuantConnect.Securities.BuyingPowerModel.

Definition at line 53 of file PatternDayTradingMarginModel.cs.

◆ GetLeverage()

override decimal QuantConnect.Securities.PatternDayTradingMarginModel.GetLeverage ( Security  security)
virtual

Gets the current leverage of the security

Parameters
securityThe security to get leverage for
Returns
The current leverage in the security

Reimplemented from QuantConnect.Securities.BuyingPowerModel.

Definition at line 62 of file PatternDayTradingMarginModel.cs.

◆ GetInitialMarginRequirement()

override InitialMargin QuantConnect.Securities.PatternDayTradingMarginModel.GetInitialMarginRequirement ( InitialMarginParameters  parameters)
virtual

The percentage of an order's absolute cost that must be held in free cash in order to place the order

Reimplemented from QuantConnect.Securities.BuyingPowerModel.

Definition at line 70 of file PatternDayTradingMarginModel.cs.

◆ GetMaintenanceMargin()

override MaintenanceMargin QuantConnect.Securities.PatternDayTradingMarginModel.GetMaintenanceMargin ( MaintenanceMarginParameters  parameters)
virtual

The percentage of the holding's absolute cost that must be held in free cash in order to avoid a margin call

Reimplemented from QuantConnect.Securities.BuyingPowerModel.

Definition at line 80 of file PatternDayTradingMarginModel.cs.


The documentation for this class was generated from the following file: