Class PositionValidator
java.lang.Object
com.bluebell.greenhouse.radicle.validation.position.PositionValidator
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidvalidateClosingOrderQuantity(Position position, PositionOrderType positionOrderType, double quantity) Validates that a closing order does not exceed the remaining open quantity.static voidvalidatePositionCanBeClosed(Position position) Validates that the givenPositioncan be closed.static voidvalidatePositionCloseDate(Position position, LocalDateTime positionClose) Validates that the given close date does not come before the open date.static voidvalidatePositionIsOpen(Position position) Validates that the givenPositionis open.static voidValidates that the givenPositiondoes not have more closing quantity than opening quantity.static voidvalidatePositionOrderPrice(Position position, PositionOrderType positionOrderType, double price) Validates that a position-order price is positive when required.static voidvalidatePositionOrderQuantity(double quantity) Validates that a position-order quantity is positive.
-
Method Details
-
validatePositionIsOpen
-
validatePositionCloseDate
Validates that the given close date does not come before the open date.- Parameters:
position-PositionpositionClose- close date
-
validatePositionCanBeClosed
-
validatePositionOpenQuantityIsNotNegative
-
validatePositionOrderQuantity
public static void validatePositionOrderQuantity(double quantity) Validates that a position-order quantity is positive.- Parameters:
quantity- order quantity
-
validatePositionOrderPrice
public static void validatePositionOrderPrice(Position position, PositionOrderType positionOrderType, double price) Validates that a position-order price is positive when required.- Parameters:
position-PositionpositionOrderType-PositionOrderTypeprice- order price
-
validateClosingOrderQuantity
public static void validateClosingOrderQuantity(Position position, PositionOrderType positionOrderType, double quantity) Validates that a closing order does not exceed the remaining open quantity.- Parameters:
position-PositionpositionOrderType-PositionOrderTypequantity- order quantity
-