Class EtdFutureSecurity
- java.lang.Object
-
- com.opengamma.strata.product.etd.EtdFutureSecurity
-
- All Implemented Interfaces:
EtdSecurity
,Product
,SecuritizedProduct
,Security
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class EtdFutureSecurity extends Object implements EtdSecurity, org.joda.beans.ImmutableBean, Serializable
An instrument representing an exchange traded derivative (ETD) future.A security representing a standardized contact between two parties to buy or sell an asset at a future date for an agreed price.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EtdFutureSecurity.Builder
The bean-builder forEtdFutureSecurity
.static class
EtdFutureSecurity.Meta
The meta-bean forEtdFutureSecurity
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EtdFutureSecurity.Builder
builder()
Returns a builder used to create an instance of the bean.EtdFuturePosition
createPosition(PositionInfo positionInfo, double longQuantity, double shortQuantity, ReferenceData refData)
Creates a position based on this security from a long and short quantity.EtdFuturePosition
createPosition(PositionInfo positionInfo, double quantity, ReferenceData refData)
Creates a position based on this security from a net quantity.EtdFutureSecurity
createProduct(ReferenceData refData)
Creates the product associated with this security.EtdFutureTrade
createTrade(TradeInfo tradeInfo, double quantity, double tradePrice, ReferenceData refData)
Creates a trade based on this security.boolean
equals(Object obj)
EtdContractSpecId
getContractSpecId()
Gets the ID of the contract specification from which this security is derived.YearMonth
getExpiry()
Gets the year-month of the expiry.SecurityInfo
getInfo()
Gets the standard security information.EtdType
getType()
Gets the type of the contract - future or option.EtdVariant
getVariant()
Gets the variant of ETD.int
hashCode()
static EtdFutureSecurity.Meta
meta()
The meta-bean forEtdFutureSecurity
.EtdFutureSecurity.Meta
metaBean()
static EtdFutureSecurity
of(EtdContractSpec spec, YearMonth expiry, EtdVariant variant)
Obtains an instance from a contract specification, expiry year-month and variant.String
summaryDescription()
Summarizes this ETD future into string form.EtdFutureSecurity.Builder
toBuilder()
Returns a builder that allows this bean to be mutated.String
toString()
EtdFutureSecurity
withInfo(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 EtdFutureSecurity of(EtdContractSpec spec, YearMonth expiry, EtdVariant variant)
Obtains an instance from a contract specification, expiry year-month and variant.The security identifier will be automatically created using
EtdIdUtils
. The specification must be for a future.- Parameters:
spec
- the future contract specificationexpiry
- the expiry year-month of the futurevariant
- the variant of the ETD, such as 'Monthly', 'Weekly, 'Daily' or 'Flex'- Returns:
- a future security based on this contract specification
- Throws:
IllegalStateException
- if the product type of the contract specification is notFUTURE
-
getType
public EtdType getType()
Description copied from interface:EtdSecurity
Gets the type of the contract - future or option.- Specified by:
getType
in interfaceEtdSecurity
- Returns:
- the type, future or option
-
withInfo
public EtdFutureSecurity withInfo(SecurityInfo info)
Description copied from interface:Security
Returns an instance with the specified info.- Specified by:
withInfo
in interfaceEtdSecurity
- Specified by:
withInfo
in interfaceSecurity
- Parameters:
info
- the new info- Returns:
- the instance with the specified info
-
createProduct
public EtdFutureSecurity createProduct(ReferenceData refData)
Description copied from interface:Security
Creates 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:
createProduct
in interfaceSecurity
- Parameters:
refData
- the reference data used to find underlying securities- Returns:
- the product
-
createTrade
public EtdFutureTrade createTrade(TradeInfo tradeInfo, 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 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 EtdFuturePosition createPosition(PositionInfo positionInfo, 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 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 EtdFuturePosition 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 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 future into string form.- Returns:
- the summary description
-
meta
public static EtdFutureSecurity.Meta meta()
The meta-bean forEtdFutureSecurity
.- Returns:
- the meta-bean, not null
-
builder
public static EtdFutureSecurity.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public EtdFutureSecurity.Meta metaBean()
- Specified by:
metaBean
in 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:
getContractSpecId
in 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:
getExpiry
in 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:
getVariant
in interfaceEtdSecurity
- Returns:
- the value of the property, not null
-
toBuilder
public EtdFutureSecurity.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-