public final class GenericSecurity extends Object implements Security, SecuritizedProduct, org.joda.beans.ImmutableBean, Serializable
In most cases, applications will choose to represent information about securities
using the relevant type, such as FixedCouponBondSecurity
,
BondFutureOptionSecurity
or IborFutureSecurity
.
Sometimes however, it can be useful to store minimal information about the security,
expressing just the tick size and tick value.
Modifier and Type | Class and Description |
---|---|
static class |
GenericSecurity.Meta
The meta-bean for
GenericSecurity . |
Modifier and Type | Method and Description |
---|---|
GenericSecurityPosition |
createPosition(PositionInfo positionInfo,
double longQuantity,
double shortQuantity,
ReferenceData refData)
Creates a position based on this security from a long and short quantity.
|
GenericSecurityPosition |
createPosition(PositionInfo tradeInfo,
double quantity,
ReferenceData refData)
Creates a position based on this security from a net quantity.
|
GenericSecurity |
createProduct(ReferenceData refData)
Creates the associated product, which simply returns
this . |
GenericSecurityTrade |
createTrade(TradeInfo info,
double quantity,
double tradePrice,
ReferenceData refData)
Creates a trade based on this security.
|
boolean |
equals(Object obj) |
Currency |
getCurrency()
Gets the currency that the security is traded in.
|
SecurityInfo |
getInfo()
Gets the standard security information.
|
SecurityId |
getSecurityId()
Gets the security identifier.
|
ImmutableSet<SecurityId> |
getUnderlyingIds()
Gets the set of underlying security identifiers.
|
int |
hashCode() |
static GenericSecurity.Meta |
meta()
The meta-bean for
GenericSecurity . |
GenericSecurity.Meta |
metaBean() |
static GenericSecurity |
of(SecurityInfo securityInfo)
Obtains an instance from security information, tick size and tick value.
|
String |
toString() |
GenericSecurity |
withInfo(SecurityInfo info)
Returns an instance with the specified info.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
allCurrencies
allPaymentCurrencies, isCrossCurrency
public static GenericSecurity of(SecurityInfo securityInfo)
securityInfo
- the security informationpublic SecurityId getSecurityId()
Security
This identifier uniquely identifies the security within the system.
getSecurityId
in interface SecuritizedProduct
getSecurityId
in interface Security
public Currency getCurrency()
Security
getCurrency
in interface SecuritizedProduct
getCurrency
in interface Security
public ImmutableSet<SecurityId> getUnderlyingIds()
Security
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.
getUnderlyingIds
in interface Security
public GenericSecurity withInfo(SecurityInfo info)
Security
public GenericSecurity createProduct(ReferenceData refData)
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.
createProduct
in interface Security
refData
- the reference data to usepublic GenericSecurityTrade createTrade(TradeInfo info, double quantity, double tradePrice, ReferenceData refData)
Security
This creates a trade of a suitable type for this security.
createTrade
in interface Security
info
- the trade informationquantity
- the number of contracts in the tradetradePrice
- the price agreed when the trade occurredrefData
- the reference data used to find underlying securitiespublic GenericSecurityPosition createPosition(PositionInfo tradeInfo, double quantity, ReferenceData refData)
Security
This creates a position of a suitable type for this security.
createPosition
in interface Security
tradeInfo
- the position informationquantity
- the number of contracts in the positionrefData
- the reference data used to find underlying securitiespublic GenericSecurityPosition createPosition(PositionInfo positionInfo, double longQuantity, double shortQuantity, ReferenceData refData)
Security
This creates a position of a suitable type for this security.
The long quantity and short quantity must be zero or positive, not negative.
createPosition
in interface Security
positionInfo
- the position informationlongQuantity
- the long quantity in the positionshortQuantity
- the short quantity in the positionrefData
- the reference data used to find underlying securitiespublic static GenericSecurity.Meta meta()
GenericSecurity
.public GenericSecurity.Meta metaBean()
metaBean
in interface org.joda.beans.Bean
public SecurityInfo getInfo()
This includes the security identifier.
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.