Class SecurityInfo

  • All Implemented Interfaces:
    Attributes, Serializable, org.joda.beans.Bean, org.joda.beans.ImmutableBean

    public final class SecurityInfo
    extends Object
    implements Attributes, org.joda.beans.ImmutableBean, Serializable
    Information about a security.

    This provides common information about a security. This includes the identifier, information about the price and an extensible data map.

    See Also:
    Serialized Form
    • Method Detail

      • of

        public static SecurityInfo of​(SecurityId id,
                                      double tickSize,
                                      CurrencyAmount tickValue)
        Obtains an instance from the identifier, tick size and tick value.

        This creates an instance, building the SecurityPriceInfo from the tick size and tick value, setting the contract size to 1.

        A SecurityInfo also contains a hash map of additional information, keyed by AttributeType. This hash map may contain anything of interest, and is populated using withAttribute(AttributeType, Object).

        Parameters:
        id - the security identifier
        tickSize - the size of each tick, not negative or zero
        tickValue - the value of each tick
        Returns:
        the security information
      • of

        public static SecurityInfo of​(SecurityId id,
                                      SecurityPriceInfo priceInfo)
        Obtains an instance from the identifier and pricing info.

        A SecurityInfo also contains a hash map of additional information, keyed by AttributeType. This hash map may contain anything of interest, and is populated using withAttribute(AttributeType, Object).

        Parameters:
        id - the security identifier
        priceInfo - the information about the price
        Returns:
        the security information
      • builder

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

        public <T> Optional<T> findAttribute​(AttributeType<T> type)
        Description copied from interface: Attributes
        Finds the attribute associated with the specified type.

        This method obtains the specified attribute. This allows an attribute to be obtained if available.

        If the attribute is not found, optional empty is returned.

        Specified by:
        findAttribute in interface Attributes
        Type Parameters:
        T - the type of the result
        Parameters:
        type - the type to find
        Returns:
        the attribute value
      • withAttribute

        public <T> SecurityInfo withAttribute​(AttributeType<T> type,
                                              T value)
        Description copied from interface: Attributes
        Returns a copy of this instance with the attribute added.

        This returns a new instance with the specified attribute added. The attribute is added using Map.put(type, value) semantics.

        Specified by:
        withAttribute in interface Attributes
        Type Parameters:
        T - the type of the attribute value
        Parameters:
        type - the type providing meaning to the value
        value - the value
        Returns:
        a new instance based on this one with the attribute added
      • withAttributes

        public SecurityInfo withAttributes​(Attributes other)
        Description copied from interface: Attributes
        Returns a copy of this instance with the attributes added.

        This returns a new instance with the specified attributes added. The attributes are added using Map.putAll(type, value) semantics.

        Specified by:
        withAttributes in interface Attributes
        Parameters:
        other - the other instance to copy from
        Returns:
        an instance based on this one with the attributes from the other instance
      • toBuilder

        public SecurityInfoBuilder toBuilder()
        Returns a builder populated with the values of this instance.
        Returns:
        a builder populated with the values of this instance
      • meta

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

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

        public SecurityId getId()
        Gets the security identifier.

        This identifier uniquely identifies the security within the system. It is the key used to lookup the security in ReferenceData.

        A real-world security will typically have multiple identifiers. The only restriction placed on the identifier is that it is sufficiently unique for the reference data lookup. As such, it is acceptable to use an identifier from a well-known global or vendor symbology.

        Returns:
        the value of the property, not null
      • getPriceInfo

        public SecurityPriceInfo getPriceInfo()
        Gets the information about the security price.

        This provides information about the security price. This can be used to convert the price into a monetary value.

        Returns:
        the value of the property, not null
      • getAttributes

        public ImmutableMap<AttributeType<?>,​Object> getAttributes()
        Gets the security attributes.

        Security attributes provide the ability to associate arbitrary information in a key-value map.

        Returns:
        the value of the property, not null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object