Lean  $LEAN_TAG$
QuantConnect.Securities.Positions.SecurityPositionGroupBuyingPowerModel Class Reference

Provides an implementation of IPositionGroupBuyingPowerModel for groups containing exactly one security More...

Inheritance diagram for QuantConnect.Securities.Positions.SecurityPositionGroupBuyingPowerModel:
[legend]

Public Member Functions

override MaintenanceMargin GetMaintenanceMargin (PositionGroupMaintenanceMarginParameters parameters)
 Gets the margin currently allocated to the specified holding More...
 
override InitialMargin GetInitialMarginRequirement (PositionGroupInitialMarginParameters parameters)
 The margin that must be held in order to increase the position by the provided quantity More...
 
override InitialMargin GetInitialMarginRequiredForOrder (PositionGroupInitialMarginForOrderParameters parameters)
 Gets the total margin required to execute the specified order in units of the account currency including fees More...
 
override GetMaximumLotsResult GetMaximumLotsForTargetBuyingPower (GetMaximumLotsForTargetBuyingPowerParameters parameters)
 Get the maximum position group order quantity to obtain a position with a given buying power percentage. Will not take into account free buying power. More...
 
override GetMaximumLotsResult GetMaximumLotsForDeltaBuyingPower (GetMaximumLotsForDeltaBuyingPowerParameters parameters)
 Get the maximum market position group order quantity to obtain a delta in the buying power used by a position group. The deltas sign defines the position side to apply it to, positive long, negative short. More...
 
override HasSufficientBuyingPowerForOrderResult HasSufficientBuyingPowerForOrder (HasSufficientPositionGroupBuyingPowerForOrderParameters parameters)
 Check if there is sufficient buying power for the position group to execute this order. More...
 
- Public Member Functions inherited from QuantConnect.Securities.Positions.PositionGroupBuyingPowerModel
virtual ReservedBuyingPowerImpact GetReservedBuyingPowerImpact (ReservedBuyingPowerImpactParameters parameters)
 Computes the impact on the portfolio's buying power from adding the position group to the portfolio. This is a 'what if' analysis to determine what the state of the portfolio would be if these changes were applied. The delta (before - after) is the margin requirement for adding the positions and if the margin used after the changes are applied is less than the total portfolio value, this indicates sufficient capital. More...
 
virtual ReservedBuyingPowerForPositionGroup GetReservedBuyingPowerForPositionGroup (ReservedBuyingPowerForPositionGroupParameters parameters)
 Computes the amount of buying power reserved by the provided position group More...
 
PositionGroupBuyingPower GetPositionGroupBuyingPower (PositionGroupBuyingPowerParameters parameters)
 Gets the buying power available for a position group trade More...
 
virtual bool Equals (IPositionGroupBuyingPowerModel other)
 Indicates whether the current object is equal to another object of the same type. More...
 
override bool Equals (object obj)
 Determines whether the specified object is equal to the current object. More...
 
override int GetHashCode ()
 Serves as the default hash function. More...
 
decimal GetPositionGroupOrderQuantity (SecurityPortfolioManager portfolio, IPositionGroup currentPositionGroup, decimal currentUsedMargin, decimal targetFinalMargin, IPositionGroup groupUnit, decimal unitMargin, out decimal finalMargin)
 Helper method 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...
 

Protected Member Functions

override HasSufficientBuyingPowerForOrderResult PassesPositionGroupSpecificBuyingPowerForOrderChecks (HasSufficientPositionGroupBuyingPowerForOrderParameters parameters, decimal availableBuyingPower)
 Additionally check initial margin requirements if the algorithm only has default position groups More...
 
- Protected Member Functions inherited from QuantConnect.Securities.Positions.PositionGroupBuyingPowerModel
 PositionGroupBuyingPowerModel (decimal requiredFreeBuyingPowerPercent=0m)
 Initializes a new instance of the PositionGroupBuyingPowerModel class More...
 
virtual decimal GetContemplatedGroupsInitialMargin (SecurityPortfolioManager portfolio, PositionGroupCollection contemplatedGroups, List< IPosition > ordersPositions)
 Gets the initial margin required for the specified contemplated position group. Used by GetReservedBuyingPowerImpact to get the contemplated groups margin. More...
 
virtual decimal ToAccountCurrency (SecurityPortfolioManager portfolio, CashAmount cash)
 Helper function to convert a CashAmount to the account currency More...
 
virtual decimal GetOrderFeeInAccountCurrency (SecurityPortfolioManager portfolio, IPositionGroup positionGroup)
 Helper function to compute the order fees associated with executing market orders for the specified positionGroup More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from QuantConnect.Securities.Positions.PositionGroupBuyingPowerModel
static bool UnableToConverge (decimal currentMarginDifference, decimal lastMarginDifference, IPositionGroup groupUnit, SecurityPortfolioManager portfolio, decimal positionGroupQuantity, decimal targetMargin, decimal currentMargin, decimal absUnitMargin, out ArgumentException error)
 Checks if the margin difference is not growing in final margin calculation, just making sure we don't end up in an infinite loop. This function was split out to support derived types using the same error message as well as removing the added noise of the check and message creation. More...
 
- Properties inherited from QuantConnect.Securities.Positions.PositionGroupBuyingPowerModel
decimal RequiredFreeBuyingPowerPercent [get]
 Gets the percentage of portfolio buying power to leave as a buffer More...
 

Detailed Description

Provides an implementation of IPositionGroupBuyingPowerModel for groups containing exactly one security

Definition at line 23 of file SecurityPositionGroupBuyingPowerModel.cs.

Member Function Documentation

◆ GetMaintenanceMargin()

override MaintenanceMargin QuantConnect.Securities.Positions.SecurityPositionGroupBuyingPowerModel.GetMaintenanceMargin ( PositionGroupMaintenanceMarginParameters  parameters)
virtual

Gets the margin currently allocated to the specified holding

Parameters
parametersAn object containing the security
Returns
The maintenance margin required for the

Implements QuantConnect.Securities.Positions.PositionGroupBuyingPowerModel.

Definition at line 30 of file SecurityPositionGroupBuyingPowerModel.cs.

Here is the call graph for this function:

◆ GetInitialMarginRequirement()

override InitialMargin QuantConnect.Securities.Positions.SecurityPositionGroupBuyingPowerModel.GetInitialMarginRequirement ( PositionGroupInitialMarginParameters  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

Implements QuantConnect.Securities.Positions.PositionGroupBuyingPowerModel.

Definition at line 53 of file SecurityPositionGroupBuyingPowerModel.cs.

◆ GetInitialMarginRequiredForOrder()

override InitialMargin QuantConnect.Securities.Positions.SecurityPositionGroupBuyingPowerModel.GetInitialMarginRequiredForOrder ( PositionGroupInitialMarginForOrderParameters  parameters)
virtual

Gets the total margin required to execute the specified order in units of the account currency including fees

Parameters
parametersAn object containing the portfolio, the security and the order
Returns
The total margin in terms of the currency quoted in the order

Implements QuantConnect.Securities.Positions.PositionGroupBuyingPowerModel.

Definition at line 72 of file SecurityPositionGroupBuyingPowerModel.cs.

◆ GetMaximumLotsForTargetBuyingPower()

override GetMaximumLotsResult QuantConnect.Securities.Positions.SecurityPositionGroupBuyingPowerModel.GetMaximumLotsForTargetBuyingPower ( GetMaximumLotsForTargetBuyingPowerParameters  parameters)
virtual

Get the maximum position group 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 position group 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.Positions.PositionGroupBuyingPowerModel.

Definition at line 96 of file SecurityPositionGroupBuyingPowerModel.cs.

Here is the call graph for this function:

◆ GetMaximumLotsForDeltaBuyingPower()

override GetMaximumLotsResult QuantConnect.Securities.Positions.SecurityPositionGroupBuyingPowerModel.GetMaximumLotsForDeltaBuyingPower ( GetMaximumLotsForDeltaBuyingPowerParameters  parameters)
virtual

Get the maximum market position group order quantity to obtain a delta in the buying power used by a position group. The deltas sign defines the position side to apply it to, positive long, negative short.

Parameters
parametersAn object containing the portfolio, the position group 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.Positions.PositionGroupBuyingPowerModel.

Definition at line 124 of file SecurityPositionGroupBuyingPowerModel.cs.

Here is the call graph for this function:

◆ HasSufficientBuyingPowerForOrder()

override HasSufficientBuyingPowerForOrderResult QuantConnect.Securities.Positions.SecurityPositionGroupBuyingPowerModel.HasSufficientBuyingPowerForOrder ( HasSufficientPositionGroupBuyingPowerForOrderParameters  parameters)
virtual

Check if there is sufficient buying power for the position group to execute this order.

Parameters
parametersAn object containing the portfolio, the position group and the order
Returns
Returns buying power information for an order against a position group

Reimplemented from QuantConnect.Securities.Positions.PositionGroupBuyingPowerModel.

Definition at line 152 of file SecurityPositionGroupBuyingPowerModel.cs.

Here is the call graph for this function:

◆ PassesPositionGroupSpecificBuyingPowerForOrderChecks()

override HasSufficientBuyingPowerForOrderResult QuantConnect.Securities.Positions.SecurityPositionGroupBuyingPowerModel.PassesPositionGroupSpecificBuyingPowerForOrderChecks ( HasSufficientPositionGroupBuyingPowerForOrderParameters  parameters,
decimal  availableBuyingPower 
)
protectedvirtual

Additionally check initial margin requirements if the algorithm only has default position groups

Reimplemented from QuantConnect.Securities.Positions.PositionGroupBuyingPowerModel.

Definition at line 173 of file SecurityPositionGroupBuyingPowerModel.cs.


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