public final class SecurityInfo extends Object implements Attributes, org.joda.beans.ImmutableBean, Serializable
This provides common information about a security. This includes the identifier, information about the price and an extensible data map.
| Modifier and Type | Class and Description |
|---|---|
static class |
SecurityInfo.Meta
The meta-bean for
SecurityInfo. |
| Modifier and Type | Method and Description |
|---|---|
static SecurityInfoBuilder |
builder()
Returns a builder used to create an instance of the bean.
|
boolean |
equals(Object obj) |
<T> Optional<T> |
findAttribute(AttributeType<T> type)
Finds the attribute associated with the specified type.
|
ImmutableMap<AttributeType<?>,Object> |
getAttributes()
Gets the security attributes.
|
ImmutableSet<AttributeType<?>> |
getAttributeTypes()
Gets the attribute types that are available.
|
SecurityId |
getId()
Gets the security identifier.
|
SecurityPriceInfo |
getPriceInfo()
Gets the information about the security price.
|
int |
hashCode() |
static SecurityInfo.Meta |
meta()
The meta-bean for
SecurityInfo. |
SecurityInfo.Meta |
metaBean() |
static SecurityInfo |
of(SecurityId id,
double tickSize,
CurrencyAmount tickValue)
Obtains an instance from the identifier, tick size and tick value.
|
static SecurityInfo |
of(SecurityId id,
SecurityPriceInfo priceInfo)
Obtains an instance from the identifier and pricing info.
|
SecurityInfoBuilder |
toBuilder()
Returns a builder populated with the values of this instance.
|
String |
toString() |
<T> SecurityInfo |
withAttribute(AttributeType<T> type,
T value)
Returns a copy of this instance with the attribute added.
|
SecurityInfo |
withAttributes(Attributes other)
Returns a copy of this instance with the attributes added.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitcontainsAttribute, containsAttribute, empty, getAttribute, ofpublic static SecurityInfo of(SecurityId id, double tickSize, CurrencyAmount tickValue)
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).
id - the security identifiertickSize - the size of each tick, not negative or zerotickValue - the value of each tickpublic static SecurityInfo of(SecurityId id, SecurityPriceInfo priceInfo)
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).
id - the security identifierpriceInfo - the information about the pricepublic static SecurityInfoBuilder builder()
public ImmutableSet<AttributeType<?>> getAttributeTypes()
Attributes
See AttributeType.captureWildcard() for a way to capture the wildcard type.
The default implementation returns an empty set (backwards compatibility prevents an abstract method for now).
getAttributeTypes in interface Attributespublic <T> Optional<T> findAttribute(AttributeType<T> type)
AttributesThis method obtains the specified attribute. This allows an attribute to be obtained if available.
If the attribute is not found, optional empty is returned.
findAttribute in interface AttributesT - the type of the resulttype - the type to findpublic <T> SecurityInfo withAttribute(AttributeType<T> type, T value)
Attributes
This returns a new instance with the specified attribute added.
The attribute is added using Map.put(type, value) semantics.
withAttribute in interface AttributesT - the type of the attribute valuetype - the type providing meaning to the valuevalue - the valuepublic SecurityInfo withAttributes(Attributes other)
Attributes
This returns a new instance with the specified attributes added.
The attributes are added using Map.putAll(type, value) semantics.
withAttributes in interface Attributesother - the other instance to copy frompublic SecurityInfoBuilder toBuilder()
public static SecurityInfo.Meta meta()
SecurityInfo.public SecurityInfo.Meta metaBean()
metaBean in interface org.joda.beans.Beanpublic SecurityId getId()
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.
public SecurityPriceInfo getPriceInfo()
This provides information about the security price. This can be used to convert the price into a monetary value.
public ImmutableMap<AttributeType<?>,Object> getAttributes()
Security attributes provide the ability to associate arbitrary information in a key-value map.
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.