Class EtdOptionSecurity
- java.lang.Object
-
- com.opengamma.strata.product.etd.EtdOptionSecurity
-
- All Implemented Interfaces:
EtdSecurity,Product,SecuritizedProduct,Security,Serializable,org.joda.beans.Bean,org.joda.beans.ImmutableBean
public final class EtdOptionSecurity extends Object implements EtdSecurity, org.joda.beans.ImmutableBean, Serializable
An instrument representing an exchange traded derivative (ETD) option.A security representing a standardized contract that gives the buyer the right but not the obligation to buy or sell an underlying asset at an agreed price.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEtdOptionSecurity.BuilderThe bean-builder forEtdOptionSecurity.static classEtdOptionSecurity.MetaThe meta-bean forEtdOptionSecurity.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EtdOptionSecurity.Builderbuilder()Returns a builder used to create an instance of the bean.EtdOptionPositioncreatePosition(PositionInfo positionInfo, double longQuantity, double shortQuantity, ReferenceData refData)Creates a position based on this security from a long and short quantity.EtdOptionPositioncreatePosition(PositionInfo positionInfo, double quantity, ReferenceData refData)Creates a position based on this security from a net quantity.EtdOptionSecuritycreateProduct(ReferenceData refData)Creates the product associated with this security.EtdOptionTradecreateTrade(TradeInfo tradeInfo, double quantity, double tradePrice, ReferenceData refData)Creates a trade based on this security.booleanequals(Object obj)EtdContractSpecIdgetContractSpecId()Gets the ID of the contract specification from which this security is derived.YearMonthgetExpiry()Gets the year-month of the expiry.SecurityInfogetInfo()Gets the standard security information.PutCallgetPutCall()Gets whether the option is a put or call.doublegetStrikePrice()Gets the strike price, in decimal form, may be negative.EtdTypegetType()Gets the type of the contract - future or option.Optional<YearMonth>getUnderlyingExpiryMonth()Gets the expiry year-month of the underlying instrument.EtdVariantgetVariant()Gets the variant of ETD.intgetVersion()Gets the version of the option, defaulted to zero.inthashCode()static EtdOptionSecurity.Metameta()The meta-bean forEtdOptionSecurity.EtdOptionSecurity.MetametaBean()static EtdOptionSecurityof(EtdContractSpec spec, YearMonth expiry, EtdVariant variant, int version, PutCall putCall, double strikePrice)Obtains an instance from a contract specification, expiry year-month, variant, version, put/call and strike price.static EtdOptionSecurityof(EtdContractSpec spec, YearMonth expiry, EtdVariant variant, int version, PutCall putCall, double strikePrice, YearMonth underlyingExpiryMonth)Obtains an instance from a contract specification, expiry year-month, variant, version, put/call, strike price and underlying expiry.StringsummaryDescription()Summarizes this ETD option into string form.EtdOptionSecurity.BuildertoBuilder()Returns a builder that allows this bean to be mutated.StringtoString()EtdOptionSecuritywithInfo(SecurityInfo info)Returns an instance with the specified info.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.opengamma.strata.product.etd.EtdSecurity
getCurrency, getSecurityId, getUnderlyingIds
-
Methods inherited from interface com.opengamma.strata.product.Product
allPaymentCurrencies, isCrossCurrency
-
Methods inherited from interface com.opengamma.strata.product.SecuritizedProduct
allCurrencies
-
-
-
-
Method Detail
-
of
public static EtdOptionSecurity of(EtdContractSpec spec, YearMonth expiry, EtdVariant variant, int version, PutCall putCall, double strikePrice)
Obtains an instance from a contract specification, expiry year-month, variant, version, put/call and strike price.The security identifier will be automatically created using
EtdIdUtils. The specification must be for an option.- Parameters:
spec- the option contract specificationexpiry- the expiry year-month of the optionvariant- the variant of the ETD, such as 'Monthly', 'Weekly, 'Daily' or 'Flex'version- the non-negative version, zero if versioning does not applyputCall- whether the option is a put or callstrikePrice- the strike price of the option- Returns:
- an option security based on this contract specification
- Throws:
IllegalStateException- if the product type of the contract specification is notOPTION
-
of
public static EtdOptionSecurity of(EtdContractSpec spec, YearMonth expiry, EtdVariant variant, int version, PutCall putCall, double strikePrice, YearMonth underlyingExpiryMonth)
Obtains an instance from a contract specification, expiry year-month, variant, version, put/call, strike price and underlying expiry.The security identifier will be automatically created using
EtdIdUtils. The specification must be for an option.- Parameters:
spec- the option contract specificationexpiry- the expiry year-month of the optionvariant- the variant of the ETD, such as 'Monthly', 'Weekly, 'Daily' or 'Flex'version- the non-negative version, zero if versioning does not applyputCall- whether the option is a put or callstrikePrice- the strike price of the optionunderlyingExpiryMonth- the expiry of the underlying instrument, such as a future, may be null- Returns:
- an option security based on this contract specification
- Throws:
IllegalStateException- if the product type of the contract specification is notOPTION
-
getType
public EtdType getType()
Description copied from interface:EtdSecurityGets the type of the contract - future or option.- Specified by:
getTypein interfaceEtdSecurity- Returns:
- the type, future or option
-
withInfo
public EtdOptionSecurity withInfo(SecurityInfo info)
Description copied from interface:SecurityReturns an instance with the specified info.- Specified by:
withInfoin interfaceEtdSecurity- Specified by:
withInfoin interfaceSecurity- Parameters:
info- the new info- Returns:
- the instance with the specified info
-
createProduct
public EtdOptionSecurity createProduct(ReferenceData refData)
Description copied from interface:SecurityCreates 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:
createProductin interfaceSecurity- Parameters:
refData- the reference data used to find underlying securities- Returns:
- the product
-
createTrade
public EtdOptionTrade createTrade(TradeInfo tradeInfo, double quantity, double tradePrice, ReferenceData refData)
Description copied from interface:SecurityCreates a trade based on this security.This creates a trade of a suitable type for this security.
- Specified by:
createTradein interfaceSecurity- Parameters:
tradeInfo- the trade informationquantity- the number of contracts in the tradetradePrice- the price agreed when the trade occurredrefData- the reference data used to find underlying securities- Returns:
- the trade
-
createPosition
public EtdOptionPosition createPosition(PositionInfo positionInfo, double quantity, ReferenceData refData)
Description copied from interface:SecurityCreates a position based on this security from a net quantity.This creates a position of a suitable type for this security.
- Specified by:
createPositionin interfaceSecurity- Parameters:
positionInfo- the position informationquantity- the number of contracts in the positionrefData- the reference data used to find underlying securities- Returns:
- the position
-
createPosition
public EtdOptionPosition createPosition(PositionInfo positionInfo, double longQuantity, double shortQuantity, ReferenceData refData)
Description copied from interface:SecurityCreates 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:
createPositionin interfaceSecurity- Parameters:
positionInfo- the position informationlongQuantity- the long quantity in the positionshortQuantity- the short quantity in the positionrefData- the reference data used to find underlying securities- Returns:
- the position
-
summaryDescription
public String summaryDescription()
Summarizes this ETD option into string form.- Returns:
- the summary description
-
meta
public static EtdOptionSecurity.Meta meta()
The meta-bean forEtdOptionSecurity.- Returns:
- the meta-bean, not null
-
builder
public static EtdOptionSecurity.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public EtdOptionSecurity.Meta metaBean()
- Specified by:
metaBeanin interfaceorg.joda.beans.Bean
-
getInfo
public SecurityInfo getInfo()
Gets the standard security information.This includes the security identifier.
-
getContractSpecId
public EtdContractSpecId getContractSpecId()
Gets the ID of the contract specification from which this security is derived.- Specified by:
getContractSpecIdin interfaceEtdSecurity- 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:
getExpiryin interfaceEtdSecurity- 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:
getVariantin interfaceEtdSecurity- Returns:
- the value of the property, not null
-
getVersion
public int getVersion()
Gets the version of the option, defaulted to zero.Some options can have multiple versions, representing some kind of change over time. Version zero is the baseline, version one and later indicates some kind of change occurred.
- Returns:
- the value of the property
-
getPutCall
public PutCall getPutCall()
Gets whether the option is a put or call.- Returns:
- the value of the property, not null
-
getStrikePrice
public double getStrikePrice()
Gets the strike price, in decimal form, may be negative.- Returns:
- the value of the property
-
getUnderlyingExpiryMonth
public Optional<YearMonth> getUnderlyingExpiryMonth()
Gets the expiry year-month of the underlying instrument.If an option has an underlying instrument, the expiry of that instrument can be specified here. For example, you can have an option expiring in March on the underlying March future, or on the underlying June future. Not all options have an underlying instrument, thus the property is optional.
In many cases, the expiry of the underlying instrument is the same as the expiry of the option. In this case, the expiry is often omitted, even though it probably should not be.
- Returns:
- the optional value of the property, not null
-
toBuilder
public EtdOptionSecurity.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-