Lean
$LEAN_TAG$
|
Provides an implementation of IPositionGroupResolver that invokes multiple wrapped implementations in succession. Each successive call to IPositionGroupResolver.Resolve will receive the remaining positions that have yet to be grouped. Any non-grouped positions are placed into identity groups. More...
Public Member Functions | |
CompositePositionGroupResolver (params IPositionGroupResolver[] resolvers) | |
Initializes a new instance of the CompositePositionGroupResolver class More... | |
CompositePositionGroupResolver (IEnumerable< IPositionGroupResolver > resolvers) | |
Initializes a new instance of the CompositePositionGroupResolver class More... | |
void | Add (IPositionGroupResolver resolver) |
Adds the specified resolver to the end of the list of resolvers. This resolver will run last. More... | |
void | Add (IPositionGroupResolver resolver, int index) |
Inserts the specified resolver into the list of resolvers at the specified index. More... | |
bool | Remove (IPositionGroupResolver resolver) |
Removes the specified resolver from the list of resolvers More... | |
PositionGroupCollection | Resolve (PositionCollection positions) |
Resolves the optimal set of IPositionGroup from the provided positions . Implementations are required to deduct grouped positions from the positions collection. 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... | |
IEnumerable< IPositionGroup > | GetImpactedGroups (PositionGroupCollection groups, IReadOnlyCollection< IPosition > positions) |
Determines the position groups that would be evaluated for grouping of the specified positions were passed into the Resolve method. More... | |
Public Attributes | |
int | Count => _resolvers.Count |
Gets the count of registered resolvers More... | |
Provides an implementation of IPositionGroupResolver that invokes multiple wrapped implementations in succession. Each successive call to IPositionGroupResolver.Resolve will receive the remaining positions that have yet to be grouped. Any non-grouped positions are placed into identity groups.
Definition at line 27 of file CompositePositionGroupResolver.cs.
QuantConnect.Securities.Positions.CompositePositionGroupResolver.CompositePositionGroupResolver | ( | params IPositionGroupResolver[] | resolvers | ) |
Initializes a new instance of the CompositePositionGroupResolver class
resolvers | The position group resolvers to be invoked in order |
Definition at line 40 of file CompositePositionGroupResolver.cs.
QuantConnect.Securities.Positions.CompositePositionGroupResolver.CompositePositionGroupResolver | ( | IEnumerable< IPositionGroupResolver > | resolvers | ) |
Initializes a new instance of the CompositePositionGroupResolver class
resolvers | The position group resolvers to be invoked in order |
Definition at line 49 of file CompositePositionGroupResolver.cs.
void QuantConnect.Securities.Positions.CompositePositionGroupResolver.Add | ( | IPositionGroupResolver | resolver | ) |
Adds the specified resolver to the end of the list of resolvers. This resolver will run last.
resolver | The resolver to be added |
Definition at line 58 of file CompositePositionGroupResolver.cs.
void QuantConnect.Securities.Positions.CompositePositionGroupResolver.Add | ( | IPositionGroupResolver | resolver, |
int | index | ||
) |
Inserts the specified resolver into the list of resolvers at the specified index.
resolver | The resolver to be inserted |
index | The zero based index indicating where to insert the resolver, zero inserts to the beginning of the list making this resolver un first and Count inserts the resolver to the end of the list making this resolver run last |
Definition at line 70 of file CompositePositionGroupResolver.cs.
bool QuantConnect.Securities.Positions.CompositePositionGroupResolver.Remove | ( | IPositionGroupResolver | resolver | ) |
Removes the specified resolver from the list of resolvers
resolver | The resolver to be removed |
Definition at line 81 of file CompositePositionGroupResolver.cs.
PositionGroupCollection QuantConnect.Securities.Positions.CompositePositionGroupResolver.Resolve | ( | PositionCollection | positions | ) |
Resolves the optimal set of IPositionGroup from the provided positions . Implementations are required to deduct grouped positions from the positions collection.
Implements QuantConnect.Securities.Positions.IPositionGroupResolver.
Definition at line 90 of file CompositePositionGroupResolver.cs.
bool QuantConnect.Securities.Positions.CompositePositionGroupResolver.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.
newPositions | The positions to be grouped |
currentPositions | The currently grouped positions |
group | The grouped positions when this resolver is able to, otherwise null |
Implements QuantConnect.Securities.Positions.IPositionGroupResolver.
Definition at line 119 of file CompositePositionGroupResolver.cs.
IEnumerable<IPositionGroup> QuantConnect.Securities.Positions.CompositePositionGroupResolver.GetImpactedGroups | ( | PositionGroupCollection | groups, |
IReadOnlyCollection< IPosition > | positions | ||
) |
Determines the position groups that would be evaluated for grouping of the specified positions were passed into the 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
groups | The existing position groups |
positions | The positions being changed |
Implements QuantConnect.Securities.Positions.IPositionGroupResolver.
Definition at line 144 of file CompositePositionGroupResolver.cs.
int QuantConnect.Securities.Positions.CompositePositionGroupResolver.Count => _resolvers.Count |
Gets the count of registered resolvers
Definition at line 32 of file CompositePositionGroupResolver.cs.