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

Provides extension methods for IPositionGroup More...

Static Public Member Functions

static IPosition GetPosition (this IPositionGroup group, Symbol symbol)
 Gets the position in the group matching the provided

Parameters
symbol
More...
 
static IPositionGroup WithQuantity (this IPositionGroup template, decimal groupQuantity, SecurityPositionGroupModel positionMananger)
 Creates a new IPositionGroup with the specified groupQuantity . If the quantity provided equals the template's quantity then the template is returned. More...
 
static IPositionGroup CreateUnitGroup (this IPositionGroup template, SecurityPositionGroupModel positionMananger)
 Creates a new IPositionGroup with each position's quantity equaling it's unit quantity More...
 
static bool IsEmpty (this IPositionGroup positionGroup)
 Determines whether the position group is empty More...
 
static bool IsInvertedOf (this IPositionGroup group, IPositionGroup other)
 Checks whether the provided groups are in opposite sides, that is, each of their positions are in opposite sides. More...
 
static bool Closes (this IPositionGroup finalGroup, IPositionGroup initialGroup)
 Checks whether the provided groups are closing/reducing each other, that is, each of their positions are in opposite sides. More...
 
static string GetUserFriendlyName (this IPositionGroup group)
 Gets a user friendly name for the provided group More...
 

Detailed Description

Provides extension methods for IPositionGroup

Definition at line 27 of file PositionGroupExtensions.cs.

Member Function Documentation

◆ GetPosition()

static IPosition QuantConnect.Securities.Positions.PositionGroupExtensions.GetPosition ( this IPositionGroup  group,
Symbol  symbol 
)
static

Gets the position in the group matching the provided

Parameters
symbol

Definition at line 32 of file PositionGroupExtensions.cs.

Here is the call graph for this function:

◆ WithQuantity()

static IPositionGroup QuantConnect.Securities.Positions.PositionGroupExtensions.WithQuantity ( this IPositionGroup  template,
decimal  groupQuantity,
SecurityPositionGroupModel  positionMananger 
)
static

Creates a new IPositionGroup with the specified groupQuantity . If the quantity provided equals the template's quantity then the template is returned.

Parameters
templateThe group template
groupQuantityThe quantity of the new group
positionManangerThe position manager to use to resolve positions
Returns
A position group with the same position ratios as the template but with the specified group quantity

Definition at line 51 of file PositionGroupExtensions.cs.

Here is the call graph for this function:

◆ CreateUnitGroup()

static IPositionGroup QuantConnect.Securities.Positions.PositionGroupExtensions.CreateUnitGroup ( this IPositionGroup  template,
SecurityPositionGroupModel  positionMananger 
)
static

Creates a new IPositionGroup with each position's quantity equaling it's unit quantity

Parameters
templateThe group template
Returns
A position group with the same position ratios as the template but with the specified group quantity

Definition at line 69 of file PositionGroupExtensions.cs.

◆ IsEmpty()

static bool QuantConnect.Securities.Positions.PositionGroupExtensions.IsEmpty ( this IPositionGroup  positionGroup)
static

Determines whether the position group is empty

Parameters
positionGroupThe position group
Returns
True if the position group is empty, that is, it has no positions, false otherwise

Definition at line 79 of file PositionGroupExtensions.cs.

◆ IsInvertedOf()

static bool QuantConnect.Securities.Positions.PositionGroupExtensions.IsInvertedOf ( this IPositionGroup  group,
IPositionGroup  other 
)
static

Checks whether the provided groups are in opposite sides, that is, each of their positions are in opposite sides.

Parameters
groupThe group to check
otherThe group to check against
Returns
Whether the position groups are the inverted version of each other, that is, contain the same positions each on the opposite side

Definition at line 92 of file PositionGroupExtensions.cs.

◆ Closes()

static bool QuantConnect.Securities.Positions.PositionGroupExtensions.Closes ( this IPositionGroup  finalGroup,
IPositionGroup  initialGroup 
)
static

Checks whether the provided groups are closing/reducing each other, that is, each of their positions are in opposite sides.

Parameters
finalGroupThe final position group that would result from a trade
initialGroupThe initial position group before a trade
Returns
Whether final resulting position group is a reduction of the initial one

Definition at line 104 of file PositionGroupExtensions.cs.

Here is the call graph for this function:

◆ GetUserFriendlyName()

static string QuantConnect.Securities.Positions.PositionGroupExtensions.GetUserFriendlyName ( this IPositionGroup  group)
static

Gets a user friendly name for the provided group

Definition at line 139 of file PositionGroupExtensions.cs.


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