Interface EtdPosition

  • All Superinterfaces:
    CalculationTarget, PortfolioItem, Position, SecurityQuantity
    All Known Implementing Classes:
    EtdFuturePosition, EtdOptionPosition

    public interface EtdPosition
    extends Position
    A position in an ETD, where the security is embedded ready for mark-to-market pricing.

    This represents a position in an ETD, defined by long and short quantity. The ETD security is embedded directly.

    The net quantity of the position is stored using two fields - longQuantity and shortQuantity. These two fields must not be negative. In many cases, only a long quantity or short quantity will be present with the other set to zero. However it is also possible for both to be non-zero, allowing long and short positions to be treated separately. The net quantity is available via getQuantity().

    • Method Detail

      • getCurrency

        default Currency getCurrency()
        Gets the currency of the position.

        This is the currency of the security.

        Returns:
        the trading currency
      • getSecurity

        EtdSecurity getSecurity()
        Gets the underlying ETD security.
        Returns:
        the ETD security
      • getType

        default EtdType getType()
        Gets the type of the contract - future or option.
        Returns:
        the type, future or option
      • getQuantity

        double getQuantity()
        Gets the net quantity of the security.

        This returns the net quantity of the underlying security. The result is positive if the net position is long and negative if the net position is short.

        This is calculated by subtracting the short quantity from the long quantity.

        Specified by:
        getQuantity in interface Position
        Specified by:
        getQuantity in interface SecurityQuantity
        Returns:
        the net quantity of the underlying security
      • getLongQuantity

        double getLongQuantity()
        Gets the long quantity of the security.

        This is the quantity of the underlying security that is held. The quantity cannot be negative, as that would imply short selling.

        Returns:
        the long quantity
      • getShortQuantity

        double getShortQuantity()
        Gets the short quantity of the security.

        This is the quantity of the underlying security that has been short sold. The quantity cannot be negative, as that would imply the position is long.

        Returns:
        the short quantity
      • withInfo

        EtdPosition withInfo​(PositionInfo info)
        Returns an instance with the specified info.
        Specified by:
        withInfo in interface Position
        Parameters:
        info - the new info
        Returns:
        the instance with the specified info
      • withQuantity

        EtdPosition withQuantity​(double quantity)
        Returns an instance with the specified quantity.
        Specified by:
        withQuantity in interface Position
        Parameters:
        quantity - the new quantity
        Returns:
        the instance with the specified quantity