Lean  $LEAN_TAG$
QuantConnect.Securities.CashBuyingPowerModel Class Reference

Represents a buying power model for cash accounts More...

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

Public Member Functions

 CashBuyingPowerModel ()
 Initializes a new instance of the CashBuyingPowerModel class More...
 
override decimal GetLeverage (Security security)
 Gets the current leverage of the security More...
 
override void SetLeverage (Security security, decimal leverage)
 Sets the leverage for the applicable securities, i.e, equities More...
 
override InitialMargin GetInitialMarginRequirement (InitialMarginParameters parameters)
 The margin that must be held in order to increase the position by the provided quantity More...
 
override HasSufficientBuyingPowerForOrderResult HasSufficientBuyingPowerForOrder (HasSufficientBuyingPowerForOrderParameters parameters)
 Check if there is sufficient buying power to execute this order. More...
 
override 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...
 
override 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...
 
override ReservedBuyingPowerForPosition GetReservedBuyingPowerForPosition (ReservedBuyingPowerForPositionParameters parameters)
 Gets the amount of buying power reserved to maintain the specified position More...
 
override BuyingPower GetBuyingPower (BuyingPowerParameters parameters)
 Gets the buying power available for a trade 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 MaintenanceMargin GetMaintenanceMargin (MaintenanceMarginParameters parameters)
 Gets the margin currently allocated to the specified holding 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...
 

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...
 
- Properties inherited from QuantConnect.Securities.BuyingPowerModel
decimal RequiredFreeBuyingPowerPercent [get, set]
 The percentage used to determine the required unused buying power for the account. More...
 

Detailed Description

Represents a buying power model for cash accounts

Definition at line 26 of file CashBuyingPowerModel.cs.

Constructor & Destructor Documentation

◆ CashBuyingPowerModel()

QuantConnect.Securities.CashBuyingPowerModel.CashBuyingPowerModel ( )

Initializes a new instance of the CashBuyingPowerModel class

Definition at line 31 of file CashBuyingPowerModel.cs.

Member Function Documentation

◆ GetLeverage()

override decimal QuantConnect.Securities.CashBuyingPowerModel.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 41 of file CashBuyingPowerModel.cs.

◆ SetLeverage()

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

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

This is added to maintain backwards compatibility with the old margin/leverage system

Parameters
securityThe security to set leverage for
leverageThe new leverage

Reimplemented from QuantConnect.Securities.BuyingPowerModel.

Definition at line 55 of file CashBuyingPowerModel.cs.

◆ GetInitialMarginRequirement()

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

The margin that must be held in order to increase the position by the provided quantity

Parameters
parametersAn object containing the security and quantity of shares

Reimplemented from QuantConnect.Securities.BuyingPowerModel.

Definition at line 67 of file CashBuyingPowerModel.cs.

◆ HasSufficientBuyingPowerForOrder()

override HasSufficientBuyingPowerForOrderResult QuantConnect.Securities.CashBuyingPowerModel.HasSufficientBuyingPowerForOrder ( HasSufficientBuyingPowerForOrderParameters  parameters)
virtual

Check if there is sufficient buying power to execute this order.

Parameters
parametersAn object containing the portfolio, the security and the order
Returns
Returns buying power information for an order

Reimplemented from QuantConnect.Securities.BuyingPowerModel.

Definition at line 82 of file CashBuyingPowerModel.cs.

Here is the call graph for this function:

◆ GetMaximumOrderQuantityForDeltaBuyingPower()

override GetMaximumOrderQuantityResult QuantConnect.Securities.CashBuyingPowerModel.GetMaximumOrderQuantityForDeltaBuyingPower ( GetMaximumOrderQuantityForDeltaBuyingPowerParameters  parameters)
virtual

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.

Parameters
parametersAn object containing the portfolio, the security and the delta buying power
Returns
Returns the maximum allowed market order quantity and if zero, also the reason

Used by the margin call model to reduce the position by a delta percent.

Reimplemented from QuantConnect.Securities.BuyingPowerModel.

Definition at line 179 of file CashBuyingPowerModel.cs.

◆ GetMaximumOrderQuantityForTargetBuyingPower()

override GetMaximumOrderQuantityResult QuantConnect.Securities.CashBuyingPowerModel.GetMaximumOrderQuantityForTargetBuyingPower ( GetMaximumOrderQuantityForTargetBuyingPowerParameters  parameters)
virtual

Get the maximum market order quantity to obtain a position with a given buying power percentage. Will not take into account free buying power.

Parameters
parametersAn object containing the portfolio, the security and the target signed buying power percentage
Returns
Returns the maximum allowed market order quantity and if zero, also the reason

Reimplemented from QuantConnect.Securities.BuyingPowerModel.

Definition at line 191 of file CashBuyingPowerModel.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetReservedBuyingPowerForPosition()

override ReservedBuyingPowerForPosition QuantConnect.Securities.CashBuyingPowerModel.GetReservedBuyingPowerForPosition ( ReservedBuyingPowerForPositionParameters  parameters)
virtual

Gets the amount of buying power reserved to maintain the specified position

Parameters
parametersA parameters object containing the security
Returns
The reserved buying power in account currency

Reimplemented from QuantConnect.Securities.BuyingPowerModel.

Definition at line 317 of file CashBuyingPowerModel.cs.

Here is the call graph for this function:

◆ GetBuyingPower()

override BuyingPower QuantConnect.Securities.CashBuyingPowerModel.GetBuyingPower ( BuyingPowerParameters  parameters)
virtual

Gets the buying power available for a trade

Parameters
parametersA parameters object containing the algorithm's portfolio, security, and order direction
Returns
The buying power available for the trade

Reimplemented from QuantConnect.Securities.BuyingPowerModel.

Definition at line 328 of file CashBuyingPowerModel.cs.

Here is the call graph for this function:

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