Class PositionUtil
java.lang.Object
com.bluebell.greenhouse.radicle.util.position.PositionUtil
Utility methods for position calculations and lifecycle metadata.
- Version:
- 3.0.1
- Author:
- Stephen Prizio
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordComputed closing metadata for aPosition.static final recordDerived reporting values for onePositionOrder. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyPositionMetrics(Position position) Applies all computed position metrics to the givenPosition.calculateOrderReporting(Position position) Calculates chronological reporting values for each order in a position.computeClosingMetadata(Position position, double accountBalance, List<MarketPrice> marketPrices) Computes closing metadata for the givenPosition.static OptionTyperesolveOptionType(String optionType) Resolves the effectiveOptionType.static PositionFamilyresolvePositionFamily(String positionFamily, Symbol symbol, Account account) Resolves the effectivePositionFamily.static PositionTyperesolvePositionType(String positionType) Resolves the effectivePositionType.
-
Method Details
-
applyPositionMetrics
-
computeClosingMetadata
public static PositionUtil.PositionClosingMetadata computeClosingMetadata(Position position, double accountBalance, List<MarketPrice> marketPrices) Computes closing metadata for the givenPosition.- Parameters:
position-PositionaccountBalance- account balancemarketPrices- market prices covering the position lifetime- Returns:
PositionUtil.PositionClosingMetadata
-
calculateOrderReporting
Calculates chronological reporting values for each order in a position.Cost-basis changes and realized results are derived from the position's signed account cash flows. They are reporting projections and are not persisted on the order entity.
- Parameters:
position-Position- Returns:
- chronological order reporting values
-
resolvePositionFamily
public static PositionFamily resolvePositionFamily(String positionFamily, Symbol symbol, Account account) Resolves the effectivePositionFamily.- Parameters:
positionFamily- explicit position family codesymbol-Symbolaccount-Account- Returns:
PositionFamily
-
resolvePositionType
Resolves the effectivePositionType.- Parameters:
positionType- explicit position type code- Returns:
PositionType
-
resolveOptionType
Resolves the effectiveOptionType.- Parameters:
optionType- explicit option type code- Returns:
OptionType
-