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); }
public virtual void roundTripFraAndFixedFloatSwap() { CurveGroupName groupName = CurveGroupName.of("Curve Group"); InterpolatedNodalCurveDefinition curveDefn = CurveTestUtils.fraSwapCurveDefinition(); CurveName curveName = curveDefn.Name; IList <CurveNode> nodes = curveDefn.Nodes; RatesCurveGroupDefinition groupDefn = RatesCurveGroupDefinition.builder().name(groupName).addCurve(curveDefn, Currency.USD, IborIndices.USD_LIBOR_3M).build(); RatesCurveGroupMarketDataFunction function = new RatesCurveGroupMarketDataFunction(); LocalDate valuationDate = date(2011, 3, 8); //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> inputData = com.google.common.collect.ImmutableMap.builder<com.opengamma.strata.data.MarketDataId<?>, double>().put(CurveTestUtils.key(nodes.get(0)), 0.0037).put(CurveTestUtils.key(nodes.get(1)), 0.0054).put(CurveTestUtils.key(nodes.get(2)), 0.005).put(CurveTestUtils.key(nodes.get(3)), 0.0087).put(CurveTestUtils.key(nodes.get(4)), 0.012).build(); IDictionary <MarketDataId <object>, double> inputData = ImmutableMap.builder <MarketDataId <object>, double>().put(CurveTestUtils.key(nodes[0]), 0.0037).put(CurveTestUtils.key(nodes[1]), 0.0054).put(CurveTestUtils.key(nodes[2]), 0.005).put(CurveTestUtils.key(nodes[3]), 0.0087).put(CurveTestUtils.key(nodes[4]), 0.012).build(); RatesCurveInputs curveInputs = RatesCurveInputs.of(inputData, DefaultCurveMetadata.of(curveName)); ScenarioMarketData inputMarketData = ImmutableScenarioMarketData.builder(valuationDate).addValue(RatesCurveInputsId.of(groupName, curveName, ObservableSource.NONE), curveInputs).build(); MarketDataBox <RatesCurveGroup> curveGroup = function.buildCurveGroup(groupDefn, CALIBRATOR, inputMarketData, REF_DATA, ObservableSource.NONE); Curve curve = curveGroup.SingleValue.findDiscountCurve(Currency.USD).get(); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.Map<com.opengamma.strata.data.MarketDataId<?>, Object> marketDataMap = com.google.common.collect.ImmutableMap.builder<com.opengamma.strata.data.MarketDataId<?>, Object>().putAll(inputData).put(com.opengamma.strata.market.curve.CurveId.of(groupName, curveName), curve).build(); IDictionary <MarketDataId <object>, object> marketDataMap = ImmutableMap.builder <MarketDataId <object>, object>().putAll(inputData).put(CurveId.of(groupName, curveName), curve).build(); MarketData marketData = ImmutableMarketData.of(valuationDate, marketDataMap); TestMarketDataMap scenarioMarketData = new TestMarketDataMap(valuationDate, marketDataMap, ImmutableMap.of()); RatesMarketDataLookup lookup = RatesMarketDataLookup.of(groupDefn); RatesProvider ratesProvider = lookup.ratesProvider(scenarioMarketData.scenario(0)); checkFraPvIsZero((FraCurveNode)nodes[0], ratesProvider, marketData); checkFraPvIsZero((FraCurveNode)nodes[1], ratesProvider, marketData); checkSwapPvIsZero((FixedIborSwapCurveNode)nodes[2], ratesProvider, marketData); checkSwapPvIsZero((FixedIborSwapCurveNode)nodes[3], ratesProvider, marketData); checkSwapPvIsZero((FixedIborSwapCurveNode)nodes[4], ratesProvider, marketData); }