Class GenericSecurity

    • Method Detail

      • of

        public static GenericSecurity of​(SecurityInfo securityInfo)
        Obtains an instance from security information, tick size and tick value.
        Parameters:
        securityInfo - the security information
        Returns:
        the security
      • getUnderlyingIds

        public ImmutableSet<SecurityId> getUnderlyingIds()
        Description copied from interface: Security
        Gets the set of underlying security identifiers.

        The set must contain all the security identifiers that this security directly refers to. For example, a bond future will return the identifiers of the underlying basket of bonds, but a bond future option will only return the identifier of the underlying future, not the basket.

        Specified by:
        getUnderlyingIds in interface Security
        Returns:
        the underlying security identifiers
      • withInfo

        public GenericSecurity withInfo​(SecurityInfo info)
        Description copied from interface: Security
        Returns an instance with the specified info.
        Specified by:
        withInfo in interface Security
        Parameters:
        info - the new info
        Returns:
        the instance with the specified info
      • createProduct

        public GenericSecurity createProduct​(ReferenceData refData)
        Creates the associated product, which simply returns this.

        The product associated with a security normally returns the financial model used for pricing. In the case of a GenericSecurity, no underlying financial model is available. As such, the GenericSecurity is the product.

        Specified by:
        createProduct in interface Security
        Parameters:
        refData - the reference data to use
        Returns:
        this security
      • createTrade

        public GenericSecurityTrade createTrade​(TradeInfo info,
                                                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:
        info - 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 GenericSecurityPosition createPosition​(PositionInfo tradeInfo,
                                                      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:
        tradeInfo - 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 GenericSecurityPosition 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
      • meta

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

        public GenericSecurity.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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object