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

Provides extension methods for IPosition More...

Static Public Member Functions

static IPosition Deduct (this IPosition position, decimal quantityToDeduct)
 Deducts the specified quantityToDeduct from the specified position More...
 
static IPosition Combine (this IPosition position, IPosition other)
 Combines the provided positions into a single position with the quantities added and the minimum unit quantity. More...
 
static Dictionary< Symbol, IPositionConsolidate (this IEnumerable< IPosition > positions)
 Consolidates the provided positions into a dictionary More...
 
static IPosition WithLots (this IPosition position, decimal numberOfLots)
 Creates a new IPosition with quantity equal to numberOfLots times its unit quantity More...
 
static decimal GetGroupQuantity (this IPosition position)
 Gets the quantity a group would have if the given position were part of it. More...
 

Detailed Description

Provides extension methods for IPosition

Definition at line 24 of file PositionExtensions.cs.

Member Function Documentation

◆ Deduct()

static IPosition QuantConnect.Securities.Positions.PositionExtensions.Deduct ( this IPosition  position,
decimal  quantityToDeduct 
)
static

Deducts the specified quantityToDeduct from the specified position

Parameters
positionThe source position
quantityToDeductThe quantity to deduct
Returns
A new position with the same properties but quantity reduced by the specified amount

Definition at line 32 of file PositionExtensions.cs.

◆ Combine()

static IPosition QuantConnect.Securities.Positions.PositionExtensions.Combine ( this IPosition  position,
IPosition  other 
)
static

Combines the provided positions into a single position with the quantities added and the minimum unit quantity.

Parameters
positionThe position
otherThe other position to add
Returns
The combined position

Definition at line 44 of file PositionExtensions.cs.

Here is the call graph for this function:

◆ Consolidate()

static Dictionary<Symbol, IPosition> QuantConnect.Securities.Positions.PositionExtensions.Consolidate ( this IEnumerable< IPosition positions)
static

Consolidates the provided positions into a dictionary

Parameters
positionsThe positions to be consolidated
Returns
A dictionary containing the consolidated positions

Definition at line 62 of file PositionExtensions.cs.

◆ WithLots()

static IPosition QuantConnect.Securities.Positions.PositionExtensions.WithLots ( this IPosition  position,
decimal  numberOfLots 
)
static

Creates a new IPosition with quantity equal to numberOfLots times its unit quantity

Parameters
positionThe position
numberOfLotsThe number of lots for the new position
Returns
A new position with the specified number of lots

Definition at line 88 of file PositionExtensions.cs.

◆ GetGroupQuantity()

static decimal QuantConnect.Securities.Positions.PositionExtensions.GetGroupQuantity ( this IPosition  position)
static

Gets the quantity a group would have if the given position were part of it.

Parameters
positionThe position
Returns
The group quantity

Definition at line 99 of file PositionExtensions.cs.


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