Class ResolvedCapitalIndexedBond
- java.lang.Object
-
- com.opengamma.strata.product.bond.ResolvedCapitalIndexedBond
-
- All Implemented Interfaces:
ResolvedProduct,Serializable,org.joda.beans.Bean,org.joda.beans.ImmutableBean
public final class ResolvedCapitalIndexedBond extends Object implements ResolvedProduct, org.joda.beans.ImmutableBean, Serializable
A capital indexed bond.This is the resolved form of
CapitalIndexedBondand is an input to the pricers. Applications will typically create aResolvedCapitalIndexedBondfrom aCapitalIndexedBondusingCapitalIndexedBond.resolve(ReferenceData).The periodic coupon payments are defined in
periodicPayments, whereasnominalPaymentseparately represents the nominal payments.The legal entity of this bond is identified by
legalEntityId. The enum,yieldConvention, specifies the yield computation convention. The accrued interest must be computed withdayCount.A
ResolvedCapitalIndexedBondis bound to data that changes over time, such as holiday calendars. If the data changes, such as the addition of a new holiday, the resolved form will not be updated. Care must be taken when placing the resolved form in a cache or persistence layer.Price
Strata uses decimal prices for bonds in the trade model, pricers and market data. For example, a price of 99.32% is represented in Strata by 0.9932.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classResolvedCapitalIndexedBond.BuilderThe bean-builder forResolvedCapitalIndexedBond.static classResolvedCapitalIndexedBond.MetaThe meta-bean forResolvedCapitalIndexedBond.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doubleaccruedInterest(LocalDate referenceDate)Calculates the accrued interest of the bond with the specified date.static ResolvedCapitalIndexedBond.Builderbuilder()Returns a builder used to create an instance of the bean.LocalDatecalculateSettlementDateFromValuation(LocalDate valuationDate, ReferenceData refData)Calculates the settlement date from the valuation date.booleanequals(Object obj)Optional<CapitalIndexedBondPaymentPeriod>findPeriod(LocalDate date)Finds the period that contains the specified date.OptionalIntfindPeriodIndex(LocalDate date)Finds the period that contains the specified date.CurrencygetCurrency()Gets the currency of the product.DayCountgetDayCount()Gets the day count convention applicable.LocalDategetEndDate()Gets the end date of the product.doublegetFirstIndexValue()Gets the first index valueFrequencygetFrequency()Gets the frequency of the bond payments.LegalEntityIdgetLegalEntityId()Gets the legal entity identifier.CapitalIndexedBondPaymentPeriodgetNominalPayment()Gets the nominal payment of the product.doublegetNotional()Gets the notional amount, must be positive.ImmutableList<CapitalIndexedBondPaymentPeriod>getPeriodicPayments()Gets the periodic payments of the product.InflationRateCalculationgetRateCalculation()Gets the inflation rate calculation.RollConventiongetRollConvention()Gets the roll convention of the bond payments.SecurityIdgetSecurityId()Gets the security identifier.DaysAdjustmentgetSettlementDateOffset()Gets the number of days between valuation date and settlement date.LocalDategetStartDate()Gets the start date of the product.LocalDategetUnadjustedEndDate()The unadjusted end date.LocalDategetUnadjustedStartDate()The unadjusted start date.CapitalIndexedBondYieldConventiongetYieldConvention()Gets yield convention.booleanhasExCouponPeriod()Checks if there is an ex-coupon period.inthashCode()static ResolvedCapitalIndexedBond.Metameta()The meta-bean forResolvedCapitalIndexedBond.ResolvedCapitalIndexedBond.MetametaBean()ResolvedCapitalIndexedBond.BuildertoBuilder()Returns a builder that allows this bean to be mutated.StringtoString()doubleyearFraction(LocalDate startDate, LocalDate endDate)Calculates the year fraction within the specified period.doubleyearFraction(LocalDate startDate, LocalDate endDate, DayCount dayCount)Calculates the year fraction within the specified period and day count.
-
-
-
Method Detail
-
getStartDate
public LocalDate getStartDate()
Gets the start date of the product.This is the first coupon period date of the bond, often known as the effective date. This date has been adjusted to be a valid business day.
- Returns:
- the start date
-
getEndDate
public LocalDate getEndDate()
Gets the end date of the product.This is the last coupon period date of the bond, often known as the maturity date. This date has been adjusted to be a valid business day.
- Returns:
- the end date
-
getUnadjustedStartDate
public LocalDate getUnadjustedStartDate()
The unadjusted start date.This is the unadjusted first coupon period date of the bond.
- Returns:
- the unadjusted start date
-
getUnadjustedEndDate
public LocalDate getUnadjustedEndDate()
The unadjusted end date.This is the unadjusted last coupon period date of the bond.
- Returns:
- the unadjusted end date
-
getCurrency
public Currency getCurrency()
Gets the currency of the product.All payments in the bond will have this currency.
- Returns:
- the currency
-
getNotional
public double getNotional()
Gets the notional amount, must be positive.The notional expressed here must be positive. The currency of the notional is specified by
getCurrency().- Returns:
- the notional amount
-
hasExCouponPeriod
public boolean hasExCouponPeriod()
Checks if there is an ex-coupon period.- Returns:
- true if has an ex-coupon period
-
getFirstIndexValue
public double getFirstIndexValue()
Gets the first index valueThis is the price index value at the start of the bond.
- Returns:
- the first index value
-
findPeriod
public Optional<CapitalIndexedBondPaymentPeriod> findPeriod(LocalDate date)
Finds the period that contains the specified date.The search is performed using unadjusted dates.
- Parameters:
date- the date to find the period for- Returns:
- the period, empty if not found
- Throws:
IllegalArgumentException- if more than one period matches
-
findPeriodIndex
public OptionalInt findPeriodIndex(LocalDate date)
Finds the period that contains the specified date.The search is performed using unadjusted dates.
- Parameters:
date- the date to find the period for- Returns:
- the period, empty if not found
- Throws:
IllegalArgumentException- if more than one period matches
-
yearFraction
public double yearFraction(LocalDate startDate, LocalDate endDate)
Calculates the year fraction within the specified period.Year fractions on bonds are calculated on unadjusted dates.
- Parameters:
startDate- the start dateendDate- the end date- Returns:
- the year fraction
- Throws:
IllegalArgumentException- if the dates are outside the range of the bond or start is after end
-
yearFraction
public double yearFraction(LocalDate startDate, LocalDate endDate, DayCount dayCount)
Calculates the year fraction within the specified period and day count.Year fractions on bonds are calculated on unadjusted dates.
- Parameters:
startDate- the start dateendDate- the end datedayCount- the day count- Returns:
- the year fraction
- Throws:
IllegalArgumentException- if the dates are outside the range of the bond or start is after end
-
calculateSettlementDateFromValuation
public LocalDate calculateSettlementDateFromValuation(LocalDate valuationDate, ReferenceData refData)
Calculates the settlement date from the valuation date.- Parameters:
valuationDate- the valuation daterefData- the reference data to use- Returns:
- the settlement date
-
accruedInterest
public double accruedInterest(LocalDate referenceDate)
Calculates the accrued interest of the bond with the specified date.- Parameters:
referenceDate- the reference date- Returns:
- the accrued interest of the product
-
meta
public static ResolvedCapitalIndexedBond.Meta meta()
The meta-bean forResolvedCapitalIndexedBond.- Returns:
- the meta-bean, not null
-
builder
public static ResolvedCapitalIndexedBond.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public ResolvedCapitalIndexedBond.Meta metaBean()
- Specified by:
metaBeanin interfaceorg.joda.beans.Bean
-
getSecurityId
public SecurityId getSecurityId()
Gets the security identifier.This identifier uniquely identifies the security within the system.
- Returns:
- the value of the property, not null
-
getNominalPayment
public CapitalIndexedBondPaymentPeriod getNominalPayment()
Gets the nominal payment of the product.The payment date of the nominal payment agrees with the final coupon payment date of the periodic payments.
- Returns:
- the value of the property, not null
-
getPeriodicPayments
public ImmutableList<CapitalIndexedBondPaymentPeriod> getPeriodicPayments()
Gets the periodic payments of the product.Each payment period represents part of the life-time of the product. The start date and end date of the leg are determined from the first and last period. As such, the periods should be sorted.
- Returns:
- the value of the property, not null
-
getFrequency
public Frequency getFrequency()
Gets the frequency of the bond payments.This must match the frequency used to generate the payment schedule.
- Returns:
- the value of the property, not null
-
getRollConvention
public RollConvention getRollConvention()
Gets the roll convention of the bond payments.This must match the convention used to generate the payment schedule.
- Returns:
- the value of the property, not null
-
getDayCount
public DayCount getDayCount()
Gets the day count convention applicable.The conversion from dates to a numerical value is made based on this day count. For the inflation-indexed bond, the day count convention is used to compute accrued interest.
- Returns:
- the value of the property, not null
-
getYieldConvention
public CapitalIndexedBondYieldConvention getYieldConvention()
Gets yield convention.The convention defines how to convert from yield to price and inversely.
- Returns:
- the value of the property, not null
-
getLegalEntityId
public LegalEntityId getLegalEntityId()
Gets the legal entity identifier.This identifier is used for the legal entity that issues the bond.
- Returns:
- the value of the property, not null
-
getSettlementDateOffset
public DaysAdjustment getSettlementDateOffset()
Gets the number of days between valuation date and settlement date.This is used to compute clean price. The clean price is the relative price to be paid at the standard settlement date in exchange for the bond.
- Returns:
- the value of the property, not null
-
getRateCalculation
public InflationRateCalculation getRateCalculation()
Gets the inflation rate calculation.The reference index is interpolated index or monthly index. Real coupons are represented by
gearingin the calculation. The price index value at the start of the bond is represented byfirstIndexValuein the calculation.- Returns:
- the value of the property, not null
-
toBuilder
public ResolvedCapitalIndexedBond.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-