Class PositionValidator

java.lang.Object
com.bluebell.greenhouse.radicle.validation.position.PositionValidator

public final class PositionValidator extends Object
Contains validation methods for Positions and position service operations.
Version:
2.0.3
Author:
Stephen Prizio
  • Method Details

    • validatePositionIsOpen

      public static void validatePositionIsOpen(Position position)
      Validates that the given Position is open.
      Parameters:
      position - Position
    • validatePositionCloseDate

      public static void validatePositionCloseDate(Position position, LocalDateTime positionClose)
      Validates that the given close date does not come before the open date.
      Parameters:
      position - Position
      positionClose - close date
    • validatePositionCanBeClosed

      public static void validatePositionCanBeClosed(Position position)
      Validates that the given Position can be closed.
      Parameters:
      position - Position
    • validatePositionOpenQuantityIsNotNegative

      public static void validatePositionOpenQuantityIsNotNegative(Position position)
      Validates that the given Position does not have more closing quantity than opening quantity.
      Parameters:
      position - Position
    • 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 - Position
      positionOrderType - PositionOrderType
      price - 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 - Position
      positionOrderType - PositionOrderType
      quantity - order quantity