/// <summary> /// Test that inputs are correctly built from market data. /// </summary> public virtual void build() { FraCurveNode node1x4 = fraNode(1, "a"); FraCurveNode node2x5 = fraNode(2, "b"); FraCurveNode node3x6 = fraNode(3, "c"); InterpolatedNodalCurveDefinition curveDefn = InterpolatedNodalCurveDefinition.builder().name(CurveName.of("curve")).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.ZERO_RATE).dayCount(DayCounts.ACT_ACT_ISDA).interpolator(CurveInterpolators.DOUBLE_QUADRATIC).extrapolatorLeft(CurveExtrapolators.FLAT).extrapolatorRight(CurveExtrapolators.FLAT).nodes(node1x4, node2x5, node3x6).build(); RatesCurveGroupDefinition groupDefn = RatesCurveGroupDefinition.builder().name(CurveGroupName.of("curve group")).addDiscountCurve(curveDefn, Currency.USD).build(); MarketDataConfig marketDataConfig = MarketDataConfig.builder().add(groupDefn.Name, groupDefn).build(); QuoteId idA = QuoteId.of(StandardId.of("test", "a")); QuoteId idB = QuoteId.of(StandardId.of("test", "b")); QuoteId idC = QuoteId.of(StandardId.of("test", "c")); ScenarioMarketData marketData = ImmutableScenarioMarketData.builder(VAL_DATE).addValue(idA, 1d).addValue(idB, 2d).addValue(idC, 3d).build(); RatesCurveInputsMarketDataFunction marketDataFunction = new RatesCurveInputsMarketDataFunction(); RatesCurveInputsId curveInputsId = RatesCurveInputsId.of(groupDefn.Name, curveDefn.Name, ObservableSource.NONE); MarketDataBox <RatesCurveInputs> result = marketDataFunction.build(curveInputsId, marketDataConfig, marketData, REF_DATA); RatesCurveInputs curveInputs = result.SingleValue; assertThat(curveInputs.MarketData.get(idA)).isEqualTo(1d); assertThat(curveInputs.MarketData.get(idB)).isEqualTo(2d); assertThat(curveInputs.MarketData.get(idC)).isEqualTo(3d); IList <ParameterMetadata> expectedMetadata = ImmutableList.of(node1x4.metadata(VAL_DATE, REF_DATA), node2x5.metadata(VAL_DATE, REF_DATA), node3x6.metadata(VAL_DATE, REF_DATA)); assertThat(curveInputs.CurveMetadata.ParameterMetadata).hasValue(expectedMetadata); }
private static MarketDataConfig config() { IDictionary <CurrencyPair, QuoteId> ratesMap = ImmutableMap.of(CURRENCY_PAIR, QUOTE_ID); FxRateConfig fxRateConfig = FxRateConfig.builder().observableRates(ratesMap).build(); return(MarketDataConfig.builder().add(ObservableSource.NONE, fxRateConfig).build()); }
/// <summary> /// End-to-end test for curve calibration and round-tripping that uses the <seealso cref="MarketDataFactory"/> /// to calibrate a curve and calculate PVs for the instruments at the curve nodes. /// /// This tests the full pipeline of market data functions: /// - Par rates /// - Curve group (including calibration) /// - Individual curves /// - Discount factors /// </summary> public virtual void roundTripFraAndFixedFloatSwap() { // Configuration and market data for the curve --------------------------------- string fra3x6 = "fra3x6"; string fra6x9 = "fra6x9"; string swap1y = "swap1y"; string swap2y = "swap2y"; string swap3y = "swap3y"; FraCurveNode fra3x6Node = fraNode(3, fra3x6); FraCurveNode fra6x9Node = fraNode(6, fra6x9); FixedIborSwapCurveNode swap1yNode = fixedIborSwapNode(Tenor.TENOR_1Y, swap1y); FixedIborSwapCurveNode swap2yNode = fixedIborSwapNode(Tenor.TENOR_2Y, swap2y); FixedIborSwapCurveNode swap3yNode = fixedIborSwapNode(Tenor.TENOR_3Y, swap3y); IDictionary <ObservableId, double> parRateData = ImmutableMap.builder <ObservableId, double>().put(id(fra3x6), 0.0037).put(id(fra6x9), 0.0054).put(id(swap1y), 0.005).put(id(swap2y), 0.0087).put(id(swap3y), 0.012).build(); LocalDate valuationDate = date(2011, 3, 8); // Build the trades from the node instruments MarketData quotes = ImmutableMarketData.of(valuationDate, parRateData); Trade fra3x6Trade = fra3x6Node.trade(1d, quotes, REF_DATA); Trade fra6x9Trade = fra6x9Node.trade(1d, quotes, REF_DATA); Trade swap1yTrade = swap1yNode.trade(1d, quotes, REF_DATA); Trade swap2yTrade = swap2yNode.trade(1d, quotes, REF_DATA); Trade swap3yTrade = swap3yNode.trade(1d, quotes, REF_DATA); IList <Trade> trades = ImmutableList.of(fra3x6Trade, fra6x9Trade, swap1yTrade, swap2yTrade, swap3yTrade); IList <CurveNode> nodes = ImmutableList.of(fra3x6Node, fra6x9Node, swap1yNode, swap2yNode, swap3yNode); CurveGroupName groupName = CurveGroupName.of("Curve Group"); CurveName curveName = CurveName.of("FRA and Fixed-Float Swap Curve"); InterpolatedNodalCurveDefinition curveDefn = InterpolatedNodalCurveDefinition.builder().name(curveName).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.ZERO_RATE).dayCount(DayCounts.ACT_ACT_ISDA).nodes(nodes).interpolator(CurveInterpolators.DOUBLE_QUADRATIC).extrapolatorLeft(CurveExtrapolators.FLAT).extrapolatorRight(CurveExtrapolators.FLAT).build(); RatesCurveGroupDefinition groupDefn = RatesCurveGroupDefinition.builder().name(groupName).addCurve(curveDefn, Currency.USD, IborIndices.USD_LIBOR_3M).build(); MarketDataConfig marketDataConfig = MarketDataConfig.builder().add(groupName, groupDefn).build(); // Rules for market data and calculations --------------------------------- RatesMarketDataLookup ratesLookup = RatesMarketDataLookup.of(groupDefn); CalculationRules calculationRules = CalculationRules.of(functions(), Currency.USD, ratesLookup); // Calculate the results and check the PVs for the node instruments are zero ---------------------- IList <Column> columns = ImmutableList.of(Column.of(Measures.PRESENT_VALUE)); MarketData knownMarketData = MarketData.of(date(2011, 3, 8), parRateData); // using the direct executor means there is no need to close/shutdown the runner CalculationTasks tasks = CalculationTasks.of(calculationRules, trades, columns, REF_DATA); MarketDataRequirements reqs = tasks.requirements(REF_DATA); MarketData enhancedMarketData = marketDataFactory().create(reqs, marketDataConfig, knownMarketData, REF_DATA); CalculationTaskRunner runner = CalculationTaskRunner.of(MoreExecutors.newDirectExecutorService()); Results results = runner.calculate(tasks, enhancedMarketData, REF_DATA); results.Cells.ForEach(this.checkPvIsZero); }
/// <summary> /// Test that requirements are empty if the curve group config exists but not the curve /// </summary> public virtual void requirementsMissingCurveDefinition() { RatesCurveInputsMarketDataFunction marketDataFunction = new RatesCurveInputsMarketDataFunction(); RatesCurveInputsId curveInputsId = RatesCurveInputsId.of(CurveGroupName.of("curve group"), CurveName.of("curve"), ObservableSource.NONE); RatesCurveGroupDefinition groupDefn = RatesCurveGroupDefinition.builder().name(CurveGroupName.of("curve group")).build(); MarketDataConfig marketDataConfig = MarketDataConfig.builder().add(groupDefn.Name, groupDefn).build(); MarketDataRequirements requirements = marketDataFunction.requirements(curveInputsId, marketDataConfig); assertThat(requirements.Observables).Empty; }
/// <summary> /// Test that a failure is returned if there is config for the curve group but it doesn't contain the named curve. /// </summary> public virtual void buildMissingCurveDefinition() { RatesCurveInputsMarketDataFunction marketDataFunction = new RatesCurveInputsMarketDataFunction(); RatesCurveInputsId curveInputsId = RatesCurveInputsId.of(CurveGroupName.of("curve group"), CurveName.of("curve"), ObservableSource.NONE); RatesCurveGroupDefinition groupDefn = RatesCurveGroupDefinition.builder().name(CurveGroupName.of("curve group")).build(); MarketDataConfig marketDataConfig = MarketDataConfig.builder().add(groupDefn.Name, groupDefn).build(); ScenarioMarketData emptyData = ScenarioMarketData.empty(); assertThrows(() => marketDataFunction.build(curveInputsId, marketDataConfig, emptyData, REF_DATA), typeof(System.ArgumentException), "No curve named .*"); }
// obtains the data and calculates the grid of results private static void calculate(CalculationRunner runner) { // the trades that will have measures calculated IList <Trade> trades = createSwapTrades(); // the columns, specifying the measures to be calculated IList <Column> columns = ImmutableList.of(Column.of(Measures.PRESENT_VALUE), Column.of(Measures.PAR_RATE), Column.of(Measures.PV01_MARKET_QUOTE_BUCKETED), Column.of(Measures.PV01_CALIBRATED_BUCKETED)); // load quotes ImmutableMap <QuoteId, double> quotesCcp1 = QuotesCsvLoader.load(VAL_DATE, QUOTES_RESOURCE_CCP1); ImmutableMap <QuoteId, double> quotesCcp2 = QuotesCsvLoader.load(VAL_DATE, QUOTES_RESOURCE_CCP2); // load fixings ImmutableMap <ObservableId, LocalDateDoubleTimeSeries> fixings = FixingSeriesCsvLoader.load(FIXINGS_RESOURCE); // create the market data MarketData marketData = ImmutableMarketData.builder(VAL_DATE).addValueMap(quotesCcp1).addValueMap(quotesCcp2).addTimeSeriesMap(fixings).build(); // the reference data, such as holidays and securities ReferenceData refData = ReferenceData.standard(); // load the curve definition IDictionary <CurveGroupName, RatesCurveGroupDefinition> defnsCcp1 = RatesCalibrationCsvLoader.load(GROUPS_RESOURCE_CCP1, SETTINGS_RESOURCE_CCP1, CALIBRATION_RESOURCE_CCP1); IDictionary <CurveGroupName, RatesCurveGroupDefinition> defnsCcp2 = RatesCalibrationCsvLoader.load(GROUPS_RESOURCE_CCP2, SETTINGS_RESOURCE_CCP2, CALIBRATION_RESOURCE_CCP2); RatesCurveGroupDefinition curveGroupDefinitionCcp1 = defnsCcp1[CURVE_GROUP_NAME_CCP1].filtered(VAL_DATE, refData); RatesCurveGroupDefinition curveGroupDefinitionCcp2 = defnsCcp2[CURVE_GROUP_NAME_CCP2].filtered(VAL_DATE, refData); // the configuration that defines how to create the curves when a curve group is requested MarketDataConfig marketDataConfig = MarketDataConfig.builder().add(CURVE_GROUP_NAME_CCP1, curveGroupDefinitionCcp1).add(CURVE_GROUP_NAME_CCP2, curveGroupDefinitionCcp2).build(); // the complete set of rules for calculating measures CalculationFunctions functions = StandardComponents.calculationFunctions(); RatesMarketDataLookup ratesLookupCcp1 = RatesMarketDataLookup.of(curveGroupDefinitionCcp1); RatesMarketDataLookup ratesLookupCcp2 = RatesMarketDataLookup.of(curveGroupDefinitionCcp2); // choose RatesMarketDataLookup instance based on counterparty TradeCounterpartyCalculationParameter perCounterparty = TradeCounterpartyCalculationParameter.of(ImmutableMap.of(CCP1_ID, ratesLookupCcp1, CCP2_ID, ratesLookupCcp2), ratesLookupCcp1); CalculationRules rules = CalculationRules.of(functions, perCounterparty); // calibrate the curves and calculate the results MarketDataRequirements reqs = MarketDataRequirements.of(rules, trades, columns, refData); MarketData calibratedMarketData = marketDataFactory().create(reqs, marketDataConfig, marketData, refData); Results results = runner.calculate(rules, trades, columns, calibratedMarketData, refData); // use the report runner to transform the engine results into a trade report ReportCalculationResults calculationResults = ReportCalculationResults.of(VAL_DATE, trades, columns, results, functions, refData); TradeReportTemplate reportTemplate = ExampleData.loadTradeReportTemplate("swap-report-template2"); TradeReport tradeReport = TradeReport.of(calculationResults, reportTemplate); tradeReport.writeAsciiTable(System.out); }
/// <summary> /// Test that the curve node requirements are extracted and returned. /// </summary> public virtual void requirements() { FraCurveNode node1x4 = fraNode(1, "a"); FraCurveNode node2x5 = fraNode(2, "b"); FraCurveNode node3x6 = fraNode(3, "c"); InterpolatedNodalCurveDefinition curve = InterpolatedNodalCurveDefinition.builder().name(CurveName.of("curve")).interpolator(CurveInterpolators.DOUBLE_QUADRATIC).extrapolatorLeft(CurveExtrapolators.FLAT).extrapolatorRight(CurveExtrapolators.FLAT).nodes(node1x4, node2x5, node3x6).build(); RatesCurveGroupDefinition groupDefn = RatesCurveGroupDefinition.builder().name(CurveGroupName.of("curve group")).addDiscountCurve(curve, Currency.USD).build(); MarketDataConfig marketDataConfig = MarketDataConfig.builder().add(groupDefn.Name, groupDefn).build(); RatesCurveInputsMarketDataFunction marketDataFunction = new RatesCurveInputsMarketDataFunction(); RatesCurveInputsId curveInputsId = RatesCurveInputsId.of(groupDefn.Name, curve.Name, ObservableSource.NONE); MarketDataRequirements requirements = marketDataFunction.requirements(curveInputsId, marketDataConfig); assertThat(requirements.Observables).contains(QuoteId.of(StandardId.of("test", "a"))).contains(QuoteId.of(StandardId.of("test", "b"))).contains(QuoteId.of(StandardId.of("test", "c"))); }
// obtains the data and calculates the grid of results private static void calculate(CalculationRunner runner) { // the trades that will have measures calculated IList <Trade> trades = createSwapTrades(); // the columns, specifying the measures to be calculated IList <Column> columns = ImmutableList.of(Column.of(Measures.LEG_INITIAL_NOTIONAL), Column.of(Measures.PRESENT_VALUE), Column.of(Measures.LEG_PRESENT_VALUE), Column.of(Measures.PV01_CALIBRATED_SUM), Column.of(Measures.PAR_RATE), Column.of(Measures.ACCRUED_INTEREST), Column.of(Measures.PV01_CALIBRATED_BUCKETED), Column.of(AdvancedMeasures.PV01_SEMI_PARALLEL_GAMMA_BUCKETED)); // load quotes ImmutableMap <QuoteId, double> quotes = QuotesCsvLoader.load(VAL_DATE, QUOTES_RESOURCE); // load fixings ImmutableMap <ObservableId, LocalDateDoubleTimeSeries> fixings = FixingSeriesCsvLoader.load(FIXINGS_RESOURCE); // create the market data MarketData marketData = MarketData.of(VAL_DATE, quotes, fixings); // the reference data, such as holidays and securities ReferenceData refData = ReferenceData.standard(); // load the curve definition IDictionary <CurveGroupName, RatesCurveGroupDefinition> defns = RatesCalibrationCsvLoader.load(GROUPS_RESOURCE, SETTINGS_RESOURCE, CALIBRATION_RESOURCE); RatesCurveGroupDefinition curveGroupDefinition = defns[CURVE_GROUP_NAME].filtered(VAL_DATE, refData); // the configuration that defines how to create the curves when a curve group is requested MarketDataConfig marketDataConfig = MarketDataConfig.builder().add(CURVE_GROUP_NAME, curveGroupDefinition).build(); // the complete set of rules for calculating measures CalculationFunctions functions = StandardComponents.calculationFunctions(); RatesMarketDataLookup ratesLookup = RatesMarketDataLookup.of(curveGroupDefinition); CalculationRules rules = CalculationRules.of(functions, ratesLookup); // calibrate the curves and calculate the results MarketDataRequirements reqs = MarketDataRequirements.of(rules, trades, columns, refData); MarketData calibratedMarketData = marketDataFactory().create(reqs, marketDataConfig, marketData, refData); Results results = runner.calculate(rules, trades, columns, calibratedMarketData, refData); // use the report runner to transform the engine results into a trade report ReportCalculationResults calculationResults = ReportCalculationResults.of(VAL_DATE, trades, columns, results, functions, refData); TradeReportTemplate reportTemplate = ExampleData.loadTradeReportTemplate("swap-report-template"); TradeReport tradeReport = TradeReport.of(calculationResults, reportTemplate); tradeReport.writeAsciiTable(System.out); }
/// <summary> /// Test that a failure is returned if the observable data isn't available. /// </summary> public virtual void buildMissingMarketData() { FraCurveNode node1x4 = fraNode(1, "a"); FraCurveNode node2x5 = fraNode(2, "b"); FraCurveNode node3x6 = fraNode(3, "c"); InterpolatedNodalCurveDefinition curve = InterpolatedNodalCurveDefinition.builder().name(CurveName.of("curve")).interpolator(CurveInterpolators.DOUBLE_QUADRATIC).extrapolatorLeft(CurveExtrapolators.FLAT).extrapolatorRight(CurveExtrapolators.FLAT).nodes(node1x4, node2x5, node3x6).build(); RatesCurveGroupDefinition groupDefn = RatesCurveGroupDefinition.builder().name(CurveGroupName.of("curve group")).addDiscountCurve(curve, Currency.USD).build(); MarketDataConfig marketDataConfig = MarketDataConfig.builder().add(groupDefn.Name, groupDefn).build(); ScenarioMarketData emptyData = ScenarioMarketData.of(1, date(2016, 6, 30), ImmutableMap.of(), ImmutableMap.of()); RatesCurveInputsMarketDataFunction marketDataFunction = new RatesCurveInputsMarketDataFunction(); RatesCurveInputsId curveInputsId = RatesCurveInputsId.of(groupDefn.Name, curve.Name, ObservableSource.NONE); assertThrows(() => marketDataFunction.build(curveInputsId, marketDataConfig, emptyData, REF_DATA), typeof(MarketDataNotFoundException)); }
public virtual void metadata() { CurveGroupName groupName = CurveGroupName.of("Curve Group"); InterpolatedNodalCurveDefinition fraCurveDefn = CurveTestUtils.fraCurveDefinition(); IList <CurveNode> fraNodes = fraCurveDefn.Nodes; RatesCurveGroupDefinition groupDefn = RatesCurveGroupDefinition.builder().name(groupName).addForwardCurve(fraCurveDefn, IborIndices.USD_LIBOR_3M).build(); MarketDataConfig marketDataConfig = MarketDataConfig.builder().add(groupName, groupDefn).build(); RatesCurveGroupId curveGroupId = RatesCurveGroupId.of(groupName); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.Map<com.opengamma.strata.data.MarketDataId<?>, double> fraInputData = com.google.common.collect.ImmutableMap.builder<com.opengamma.strata.data.MarketDataId<?>, double>().put(CurveTestUtils.key(fraNodes.get(0)), 0.003).put(CurveTestUtils.key(fraNodes.get(1)), 0.0033).put(CurveTestUtils.key(fraNodes.get(2)), 0.0037).put(CurveTestUtils.key(fraNodes.get(3)), 0.0054).put(CurveTestUtils.key(fraNodes.get(4)), 0.007).put(CurveTestUtils.key(fraNodes.get(5)), 0.0091).put(CurveTestUtils.key(fraNodes.get(6)), 0.0134).build(); IDictionary <MarketDataId <object>, double> fraInputData = ImmutableMap.builder <MarketDataId <object>, double>().put(CurveTestUtils.key(fraNodes[0]), 0.003).put(CurveTestUtils.key(fraNodes[1]), 0.0033).put(CurveTestUtils.key(fraNodes[2]), 0.0037).put(CurveTestUtils.key(fraNodes[3]), 0.0054).put(CurveTestUtils.key(fraNodes[4]), 0.007).put(CurveTestUtils.key(fraNodes[5]), 0.0091).put(CurveTestUtils.key(fraNodes[6]), 0.0134).build(); LocalDate valuationDate = date(2011, 3, 8); RatesCurveInputs fraCurveInputs = RatesCurveInputs.of(fraInputData, fraCurveDefn.metadata(valuationDate, REF_DATA)); ScenarioMarketData marketData = ImmutableScenarioMarketData.builder(valuationDate).addValue(RatesCurveInputsId.of(groupName, fraCurveDefn.Name, ObservableSource.NONE), fraCurveInputs).build(); RatesCurveGroupMarketDataFunction function = new RatesCurveGroupMarketDataFunction(); MarketDataBox <RatesCurveGroup> curveGroup = function.build(curveGroupId, marketDataConfig, marketData, REF_DATA); // Check the FRA curve identifiers are the expected tenors Curve forwardCurve = curveGroup.SingleValue.findForwardCurve(IborIndices.USD_LIBOR_3M).get(); IList <ParameterMetadata> forwardMetadata = forwardCurve.Metadata.ParameterMetadata.get(); //JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter: //JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter: IList <object> forwardTenors = forwardMetadata.Select(ParameterMetadata::getIdentifier).collect(toImmutableList()); IList <Tenor> expectedForwardTenors = ImmutableList.of(Tenor.TENOR_4M, Tenor.TENOR_5M, Tenor.TENOR_6M, Tenor.TENOR_9M, Tenor.TENOR_12M, Tenor.ofMonths(15), Tenor.ofMonths(21)); assertThat(forwardTenors).isEqualTo(expectedForwardTenors); //JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter: IList <ParameterMetadata> expectedForwardMetadata = fraNodes.Select(node => node.metadata(valuationDate, REF_DATA)).collect(toImmutableList()); assertThat(forwardMetadata).isEqualTo(expectedForwardMetadata); }
// calculates the PV results for the instruments used in calibration from the config private static Pair <IList <Trade>, Results> calculate(CalculationRunner runner) { // the reference data, such as holidays and securities ReferenceData refData = ReferenceData.standard(); // load quotes ImmutableMap <QuoteId, double> quotes = QuotesCsvLoader.load(VAL_DATE, QUOTES_RESOURCE); // load time series IDictionary <ObservableId, LocalDateDoubleTimeSeries> fixings = FixingSeriesCsvLoader.load(FIXING_RESOURCE); // create the market data MarketData marketData = ImmutableMarketData.builder(VAL_DATE).addValueMap(quotes).addTimeSeriesMap(fixings).build(); // load the curve definition IDictionary <CurveGroupName, RatesCurveGroupDefinition> defns = RatesCalibrationCsvLoader.load(GROUPS_RESOURCE, SETTINGS_RESOURCE, CALIBRATION_RESOURCE); RatesCurveGroupDefinition curveGroupDefinition = defns[CURVE_GROUP_NAME].filtered(VAL_DATE, refData); // extract the trades used for calibration IList <Trade> trades = curveGroupDefinition.CurveDefinitions.stream().flatMap(defn => defn.Nodes.stream()).filter(node => !(node is IborFixingDepositCurveNode)).map(node => node.trade(1d, marketData, refData)).collect(toImmutableList()); // the columns, specifying the measures to be calculated IList <Column> columns = ImmutableList.of(Column.of(Measures.PRESENT_VALUE)); // the configuration that defines how to create the curves when a curve group is requested MarketDataConfig marketDataConfig = MarketDataConfig.builder().add(CURVE_GROUP_NAME, curveGroupDefinition).build(); // the complete set of rules for calculating measures CalculationFunctions functions = StandardComponents.calculationFunctions(); RatesMarketDataLookup ratesLookup = RatesMarketDataLookup.of(curveGroupDefinition); CalculationRules rules = CalculationRules.of(functions, ratesLookup); // calibrate the curves and calculate the results MarketDataRequirements reqs = MarketDataRequirements.of(rules, trades, columns, refData); MarketData calibratedMarketData = marketDataFactory().create(reqs, marketDataConfig, marketData, refData); Results results = runner.calculate(rules, trades, columns, calibratedMarketData, refData); return(Pair.of(trades, results)); }
/// <summary> /// Tests that par rates and ibor index are required for curves. /// </summary> public virtual void requirements() { FraCurveNode node1x4 = CurveTestUtils.fraNode(1, "foo"); FraCurveNode node2x5 = CurveTestUtils.fraNode(2, "foo"); IList <CurveNode> nodes = ImmutableList.of(node1x4, node2x5); CurveGroupName groupName = CurveGroupName.of("Curve Group"); CurveName curveName = CurveName.of("FRA Curve"); ObservableSource obsSource = ObservableSource.of("Vendor"); InterpolatedNodalCurveDefinition curveDefn = InterpolatedNodalCurveDefinition.builder().name(curveName).nodes(nodes).interpolator(CurveInterpolators.DOUBLE_QUADRATIC).extrapolatorLeft(CurveExtrapolators.FLAT).extrapolatorRight(CurveExtrapolators.FLAT).build(); RateIndex ibor = IborIndices.USD_LIBOR_3M; RatesCurveGroupDefinition groupDefn = RatesCurveGroupDefinition.builder().name(groupName).addCurve(curveDefn, Currency.USD, ibor).build(); MarketDataConfig marketDataConfig = MarketDataConfig.builder().add(groupName, groupDefn).build(); RatesCurveGroupMarketDataFunction function = new RatesCurveGroupMarketDataFunction(); RatesCurveGroupId curveGroupId = RatesCurveGroupId.of(groupName, obsSource); MarketDataRequirements requirements = function.requirements(curveGroupId, marketDataConfig); assertThat(requirements.NonObservables).contains(RatesCurveInputsId.of(groupName, curveName, obsSource)); assertThat(requirements.TimeSeries.contains(IndexQuoteId.of(ibor))); }