/** * Returns a copy of this definition with a different name. * * @param name the name of the new curve group definition * @return a copy of this curve group definition with a different name */ public RatesCurveGroupDefinition withName(CurveGroupName name) { return new RatesCurveGroupDefinition( name, entries, curveDefinitions, seasonalityDefinitions, computeJacobian, computePvSensitivityToMarketQuote); }
@Override public RatesCurveGroupDefinition build() { preBuild(this); return new RatesCurveGroupDefinition( name, entries, curveDefinitions, seasonalityDefinitions, computeJacobian, computePvSensitivityToMarketQuote); }
private Object readResolve() { return new RatesCurveGroupDefinition( name, entries, curveDefinitions, seasonalityDefinitions, computeJacobian, computePvSensitivityToMarketQuote); }
/** * Returns a curve group definition with the specified name and containing the specified entries and seasonality. * <p> * The Jacobian matrices are computed. The Present Value sensitivity to Market quotes are not computed. * * @param name the name of the curve group * @param entries entries describing the curves in the group * @param curveDefinitions definitions which specify how the curves are calibrated * @param seasonalityDefinitions definitions which specify the seasonality to use for different curves * @return a curve group definition with the specified name and containing the specified entries */ public static RatesCurveGroupDefinition of( CurveGroupName name, Collection<RatesCurveGroupEntry> entries, Collection<CurveDefinition> curveDefinitions, Map<CurveName, SeasonalityDefinition> seasonalityDefinitions) { return new RatesCurveGroupDefinition(name, entries, curveDefinitions, seasonalityDefinitions, true, false); }
/** * Returns a curve group definition with the specified name and containing the specified entries. * <p> * The Jacobian matrices are computed. The Present Value sensitivity to Market quotes are not computed. * * @param name the name of the curve group * @param entries entries describing the curves in the group * @param curveDefinitions definitions which specify how the curves are calibrated * @return a curve group definition with the specified name and containing the specified entries */ public static RatesCurveGroupDefinition of( CurveGroupName name, Collection<RatesCurveGroupEntry> entries, Collection<CurveDefinition> curveDefinitions) { return new RatesCurveGroupDefinition(name, entries, curveDefinitions, ImmutableMap.of(), true, false); }
/** * Builds the definition of the curve group from the data in this object. * * @return the definition of the curve group built from the data in this object */ public RatesCurveGroupDefinition build() { // note that this defaults the jacobian flag based on the market quote flag return new RatesCurveGroupDefinition( name, entries.values(), curveDefinitions.values(), seasonalityDefinitions, computeJacobian || computePvSensitivityToMarketQuote, computePvSensitivityToMarketQuote); }
/** * Returns a copy of this object containing the specified curve definitions. * <p> * Curves are ignored if there is no entry in this definition with the same curve name. * * @param curveDefinitions curve definitions * @return a copy of this object containing the specified curve definitions */ public RatesCurveGroupDefinition withCurveDefinitions(List<CurveDefinition> curveDefinitions) { Set<CurveName> curveNames = entries.stream().map(entry -> entry.getCurveName()).collect(toSet()); List<CurveDefinition> filteredDefinitions = curveDefinitions.stream().filter(def -> curveNames.contains(def.getName())).collect(toImmutableList()); return new RatesCurveGroupDefinition( name, entries, filteredDefinitions, seasonalityDefinitions, computeJacobian, computePvSensitivityToMarketQuote); }
/** * Returns a filtered version of this definition with no invalid nodes. * <p> * A curve is formed of a number of nodes, each of which has an associated date. * To be valid, the curve node dates must be in order from earliest to latest. * This method applies rules to remove invalid nodes. * * @param valuationDate the valuation date * @param refData the reference data * @return the resolved definition, that should be used in preference to this one * @throws IllegalArgumentException if the curve nodes are invalid */ public RatesCurveGroupDefinition filtered(LocalDate valuationDate, ReferenceData refData) { List<CurveDefinition> filtered = curveDefinitions.stream() .map(ncd -> ncd.filtered(valuationDate, refData)) .collect(toImmutableList()); return new RatesCurveGroupDefinition( name, entries, filtered, seasonalityDefinitions, computeJacobian, computePvSensitivityToMarketQuote); }
/** * Returns a copy of this object containing the specified seasonality definitions. * <p> * Seasonality definitions are ignored if there is no entry in this definition with the same curve name. * * @param seasonalityDefinitions seasonality definitions * @return a copy of this object containing the specified seasonality definitions */ public RatesCurveGroupDefinition withSeasonalityDefinitions(Map<CurveName, SeasonalityDefinition> seasonalityDefinitions) { Set<CurveName> curveNames = entries.stream().map(entry -> entry.getCurveName()).collect(toSet()); Map<CurveName, SeasonalityDefinition> filteredDefinitions = MapStream.of(seasonalityDefinitions) .filterKeys(cn -> curveNames.contains(cn)).toMap(); return new RatesCurveGroupDefinition( name, entries, curveDefinitions, filteredDefinitions, computeJacobian, computePvSensitivityToMarketQuote); }
return new RatesCurveGroupDefinition( name, combinedEntries.values(),