Class OvernightFutureTemplate
- java.lang.Object
-
- com.opengamma.strata.product.index.type.OvernightFutureTemplate
-
- All Implemented Interfaces:
TradeTemplate
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class OvernightFutureTemplate extends Object implements TradeTemplate, org.joda.beans.ImmutableBean, Serializable
A template for creating an Overnight Future trade.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description LocalDate
calculateLastFixingDateFromTradeDate(LocalDate tradeDate, ReferenceData refData)
Calculates the last fixing date of the trade.LocalDate
calculateReferenceDateFromTradeDate(LocalDate tradeDate, ReferenceData refData)
Calculates the reference date of the trade.OvernightFutureTrade
createTrade(LocalDate tradeDate, SecurityId securityId, double quantity, double price, ReferenceData refData)
Creates a trade based on this template.boolean
equals(Object obj)
OvernightFutureContractSpec
getContractSpec()
Gets the underlying contract specification.OvernightIndex
getIndex()
Gets the underlying index.SequenceDate
getSequenceDate()
Gets the instructions that define which future is desired.int
hashCode()
static org.joda.beans.TypedMetaBean<OvernightFutureTemplate>
meta()
The meta-bean forOvernightFutureTemplate
.org.joda.beans.TypedMetaBean<OvernightFutureTemplate>
metaBean()
static OvernightFutureTemplate
of(SequenceDate sequenceDate, OvernightFutureContractSpec contractSpec)
Obtains a template based on the specified contract specification and sequence date.String
toString()
-
-
-
Method Detail
-
of
public static OvernightFutureTemplate of(SequenceDate sequenceDate, OvernightFutureContractSpec contractSpec)
Obtains a template based on the specified contract specification and sequence date.The specific future is defined by two date-related inputs - the sequence date and the date sequence embedded in the contract specification.
- Parameters:
sequenceDate
- the instructions that define which future is desiredcontractSpec
- the contract specification- Returns:
- the template
-
getIndex
public OvernightIndex getIndex()
Gets the underlying index.- Returns:
- the index
-
createTrade
public OvernightFutureTrade createTrade(LocalDate tradeDate, SecurityId securityId, double quantity, double price, ReferenceData refData)
Creates a trade based on this template.This returns a trade based on the specified date.
- Parameters:
tradeDate
- the date of the tradesecurityId
- the identifier of the securityquantity
- the number of contracts traded, positive if buying, negative if sellingprice
- the trade pricerefData
- the reference data, used to resolve the trade dates- Returns:
- the trade
- Throws:
ReferenceDataNotFoundException
- if an identifier cannot be resolved in the reference data
-
calculateReferenceDateFromTradeDate
public LocalDate calculateReferenceDateFromTradeDate(LocalDate tradeDate, ReferenceData refData)
Calculates the reference date of the trade.- Parameters:
tradeDate
- the date of the traderefData
- the reference data, used to resolve the date- Returns:
- the future reference date
-
calculateLastFixingDateFromTradeDate
public LocalDate calculateLastFixingDateFromTradeDate(LocalDate tradeDate, ReferenceData refData)
Calculates the last fixing date of the trade.- Parameters:
tradeDate
- the date of the traderefData
- the reference data, used to resolve the date- Returns:
- the future reference date
-
meta
public static org.joda.beans.TypedMetaBean<OvernightFutureTemplate> meta()
The meta-bean forOvernightFutureTemplate
.- Returns:
- the meta-bean, not null
-
metaBean
public org.joda.beans.TypedMetaBean<OvernightFutureTemplate> metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getSequenceDate
public SequenceDate getSequenceDate()
Gets the instructions that define which future is desired.- Returns:
- the value of the property, not null
-
getContractSpec
public OvernightFutureContractSpec getContractSpec()
Gets the underlying contract specification.This specifies the contract of the Overnight Futures to be created.
- Returns:
- the value of the property, not null
-
-