Class EtdFutureSecurity

    • Method Detail

      • of

        public static EtdFutureSecurity of​(EtdContractSpec spec,
                                           YearMonth expiry,
                                           EtdVariant variant)
        Obtains an instance from a contract specification, expiry year-month and variant.

        The security identifier will be automatically created using EtdIdUtils. The specification must be for a future.

        Parameters:
        spec - the future contract specification
        expiry - the expiry year-month of the future
        variant - the variant of the ETD, such as 'Monthly', 'Weekly, 'Daily' or 'Flex'
        Returns:
        a future security based on this contract specification
        Throws:
        IllegalStateException - if the product type of the contract specification is not FUTURE
      • getType

        public EtdType getType()
        Description copied from interface: EtdSecurity
        Gets the type of the contract - future or option.
        Specified by:
        getType in interface EtdSecurity
        Returns:
        the type, future or option
      • createProduct

        public EtdFutureSecurity createProduct​(ReferenceData refData)
        Description copied from interface: Security
        Creates the product associated with this security.

        The product of a security is distinct from the security. The product includes the financial details from this security, but excludes the additional information. The product also includes the products of any underlying securities.

        Specified by:
        createProduct in interface Security
        Parameters:
        refData - the reference data used to find underlying securities
        Returns:
        the product
      • createTrade

        public EtdFutureTrade createTrade​(TradeInfo tradeInfo,
                                          double quantity,
                                          double tradePrice,
                                          ReferenceData refData)
        Description copied from interface: Security
        Creates a trade based on this security.

        This creates a trade of a suitable type for this security.

        Specified by:
        createTrade in interface Security
        Parameters:
        tradeInfo - the trade information
        quantity - the number of contracts in the trade
        tradePrice - the price agreed when the trade occurred
        refData - the reference data used to find underlying securities
        Returns:
        the trade
      • createPosition

        public EtdFuturePosition createPosition​(PositionInfo positionInfo,
                                                double quantity,
                                                ReferenceData refData)
        Description copied from interface: Security
        Creates a position based on this security from a net quantity.

        This creates a position of a suitable type for this security.

        Specified by:
        createPosition in interface Security
        Parameters:
        positionInfo - the position information
        quantity - the number of contracts in the position
        refData - the reference data used to find underlying securities
        Returns:
        the position
      • createPosition

        public EtdFuturePosition createPosition​(PositionInfo positionInfo,
                                                double longQuantity,
                                                double shortQuantity,
                                                ReferenceData refData)
        Description copied from interface: Security
        Creates a position based on this security from a long and short quantity.

        This creates a position of a suitable type for this security.

        The long quantity and short quantity must be zero or positive, not negative.

        Specified by:
        createPosition in interface Security
        Parameters:
        positionInfo - the position information
        longQuantity - the long quantity in the position
        shortQuantity - the short quantity in the position
        refData - the reference data used to find underlying securities
        Returns:
        the position
      • summaryDescription

        public String summaryDescription()
        Summarizes this ETD future into string form.
        Returns:
        the summary description
      • meta

        public static EtdFutureSecurity.Meta meta()
        The meta-bean for EtdFutureSecurity.
        Returns:
        the meta-bean, not null
      • builder

        public static EtdFutureSecurity.Builder builder()
        Returns a builder used to create an instance of the bean.
        Returns:
        the builder, not null
      • metaBean

        public EtdFutureSecurity.Meta metaBean()
        Specified by:
        metaBean in interface org.joda.beans.Bean
      • getInfo

        public SecurityInfo getInfo()
        Gets the standard security information.

        This includes the security identifier.

        Specified by:
        getInfo in interface Security
        Returns:
        the value of the property, not null
      • getContractSpecId

        public EtdContractSpecId getContractSpecId()
        Gets the ID of the contract specification from which this security is derived.
        Specified by:
        getContractSpecId in interface EtdSecurity
        Returns:
        the value of the property, not null
      • getExpiry

        public YearMonth getExpiry()
        Gets the year-month of the expiry.

        Expiry will occur on a date implied by the variant of the ETD.

        Specified by:
        getExpiry in interface EtdSecurity
        Returns:
        the value of the property, not null
      • getVariant

        public EtdVariant getVariant()
        Gets the variant of ETD.

        This captures the variant of the ETD. The most common variant is 'Monthly'. Other variants are 'Weekly', 'Daily' and 'Flex'.

        When building, this defaults to 'Monthly'.

        Specified by:
        getVariant in interface EtdSecurity
        Returns:
        the value of the property, not null
      • toBuilder

        public EtdFutureSecurity.Builder toBuilder()
        Returns a builder that allows this bean to be mutated.
        Returns:
        the mutable builder, not null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object