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

Provides an implementation of IPositionGroupResolver that places all positions into a default group of one security. More...

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

Public Member Functions

 SecurityPositionGroupResolver (IPositionGroupBuyingPowerModel buyingPowerModel)
 Initializes a new instance of the SecurityPositionGroupResolver class More...
 
bool TryGroup (IReadOnlyCollection< IPosition > newPositions, PositionGroupCollection currentPositions, out IPositionGroup group)
 Attempts to group the specified positions into a new IPositionGroup using an appropriate IPositionGroupBuyingPowerModel for position groups created via this resolver. More...
 
PositionGroupCollection Resolve (PositionCollection positions)
 Resolves the position groups that exist within the specified collection of positions. More...
 
IEnumerable< IPositionGroupGetImpactedGroups (PositionGroupCollection groups, IReadOnlyCollection< IPosition > positions)
 Determines the position groups that would be evaluated for grouping of the specified positions were passed into the IPositionGroupResolver.Resolve method. More...
 

Detailed Description

Provides an implementation of IPositionGroupResolver that places all positions into a default group of one security.

Definition at line 24 of file SecurityPositionGroupResolver.cs.

Constructor & Destructor Documentation

◆ SecurityPositionGroupResolver()

QuantConnect.Securities.Positions.SecurityPositionGroupResolver.SecurityPositionGroupResolver ( IPositionGroupBuyingPowerModel  buyingPowerModel)

Initializes a new instance of the SecurityPositionGroupResolver class

Parameters
buyingPowerModelThe buying power model to use for created groups

Definition at line 32 of file SecurityPositionGroupResolver.cs.

Member Function Documentation

◆ TryGroup()

bool QuantConnect.Securities.Positions.SecurityPositionGroupResolver.TryGroup ( IReadOnlyCollection< IPosition newPositions,
PositionGroupCollection  currentPositions,
out IPositionGroup  group 
)

Attempts to group the specified positions into a new IPositionGroup using an appropriate IPositionGroupBuyingPowerModel for position groups created via this resolver.

Parameters
newPositionsThe positions to be grouped
currentPositionsThe currently grouped positions
groupThe grouped positions when this resolver is able to, otherwise null
Returns
True if this resolver can group the specified positions, otherwise false

Implements QuantConnect.Securities.Positions.IPositionGroupResolver.

Definition at line 46 of file SecurityPositionGroupResolver.cs.

◆ Resolve()

PositionGroupCollection QuantConnect.Securities.Positions.SecurityPositionGroupResolver.Resolve ( PositionCollection  positions)

Resolves the position groups that exist within the specified collection of positions.

Parameters
positionsThe collection of positions
Returns
An enumerable of position groups

Implements QuantConnect.Securities.Positions.IPositionGroupResolver.

Definition at line 66 of file SecurityPositionGroupResolver.cs.

Here is the call graph for this function:

◆ GetImpactedGroups()

IEnumerable<IPositionGroup> QuantConnect.Securities.Positions.SecurityPositionGroupResolver.GetImpactedGroups ( PositionGroupCollection  groups,
IReadOnlyCollection< IPosition positions 
)

Determines the position groups that would be evaluated for grouping of the specified positions were passed into the IPositionGroupResolver.Resolve method.

This function allows us to determine a set of impacted groups and run the resolver on just those groups in order to support what-if analysis

Parameters
groupsThe existing position groups
positionsThe positions being changed
Returns
An enumerable containing the position groups that could be impacted by the specified position changes

Implements QuantConnect.Securities.Positions.IPositionGroupResolver.

Definition at line 87 of file SecurityPositionGroupResolver.cs.


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