//------------------------------------------------------------------------- public FunctionRequirements requirements(SecurityId securityId, LegalEntityId issuerId, Currency currency) { // repo RepoGroup repoKey = repoCurveSecurityGroups.get(securityId); if (repoKey == null) { repoKey = repoCurveGroups.get(issuerId); } if (repoKey == null) { throw new System.ArgumentException(Messages.format("Legal entity discounting lookup has no repo curve defined for '{}' and '{}'", securityId, issuerId)); } CurveId repoCurveId = repoCurves.get(Pair.of(repoKey, currency)); if (repoCurveId == null) { throw new System.ArgumentException(Messages.format("Legal entity discounting lookup has no repo curve defined for '{}' and '{}'", securityId, issuerId)); } // issuer LegalEntityGroup issuerKey = issuerCurveGroups.get(issuerId); if (issuerKey == null) { throw new System.ArgumentException(Messages.format("Legal entity discounting lookup has no issuer curve defined for '{}'", issuerId)); } CurveId issuerCurveId = issuerCurves.get(Pair.of(issuerKey, currency)); if (issuerCurveId == null) { throw new System.ArgumentException(Messages.format("Legal entity discounting lookup has no issuer curve defined for '{}'", issuerId)); } // result return(FunctionRequirements.builder().valueRequirements(ImmutableSet.of(repoCurveId, issuerCurveId)).outputCurrencies(currency).observableSource(observableSource).build()); }
public ImmutableLegalEntityDiscountingProvider toImmutableLegalEntityDiscountingProvider() { // repo curves IDictionary <Pair <RepoGroup, Currency>, DiscountFactors> repoCurves = new Dictionary <Pair <RepoGroup, Currency>, DiscountFactors>(); foreach (Pair <RepoGroup, Currency> pair in lookup.RepoCurves.Keys) { CurveId curveId = lookup.RepoCurves.get(pair); if (marketData.containsValue(curveId)) { Curve curve = marketData.getValue(curveId); repoCurves[pair] = DiscountFactors.of(pair.Second, ValuationDate, curve); } } // issuer curves IDictionary <Pair <LegalEntityGroup, Currency>, DiscountFactors> issuerCurves = new Dictionary <Pair <LegalEntityGroup, Currency>, DiscountFactors>(); foreach (Pair <LegalEntityGroup, Currency> pair in lookup.IssuerCurves.Keys) { CurveId curveId = lookup.IssuerCurves.get(pair); if (marketData.containsValue(curveId)) { Curve curve = marketData.getValue(curveId); issuerCurves[pair] = DiscountFactors.of(pair.Second, ValuationDate, curve); } } // build result return(ImmutableLegalEntityDiscountingProvider.builder().valuationDate(ValuationDate).repoCurveSecurityGroups(lookup.RepoCurveSecurityGroups).repoCurveGroups(lookup.RepoCurveGroups).repoCurves(repoCurves).issuerCurveGroups(lookup.IssuerCurveGroups).issuerCurves(issuerCurves).build()); }
private static void CloneAndAddCurve(Animator targetAnimator, Dictionary <Guid, Guid> oldToNewIdDict, CurveId id, Curve curve) { Guid newInstanceId = oldToNewIdDict[id.SymbolChildId]; var newCurveId = new CurveId(newInstanceId, id.InputId, id.Index); var newCurve = curve.TypedClone(); targetAnimator._animatedInputCurves.Add(newCurveId, newCurve); }
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: @Override public com.google.common.collect.ImmutableSet<com.opengamma.strata.data.MarketDataId<?>> getForwardMarketDataIds(com.opengamma.strata.basics.index.Index index) public ImmutableSet <MarketDataId <object> > getForwardMarketDataIds(Index index) { CurveId id = forwardCurves.get(index); if (id == null) { throw new System.ArgumentException(msgIndexNotFound(index)); } return(ImmutableSet.of(id)); }
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: @Override public com.google.common.collect.ImmutableSet<com.opengamma.strata.data.MarketDataId<?>> getDiscountMarketDataIds(com.opengamma.strata.basics.currency.Currency currency) public ImmutableSet <MarketDataId <object> > getDiscountMarketDataIds(Currency currency) { CurveId id = discountCurves.get(currency); if (id == null) { throw new System.ArgumentException(msgCurrencyNotFound(currency)); } return(ImmutableSet.of(id)); }
public RecoveryRates recoveryRates(StandardId legalEntityId) { CurveId curveId = lookup.RecoveryRateCurveIds.get(legalEntityId); if (curveId == null) { throw new MarketDataNotFoundException("Unable to find recovery rate curve: " + legalEntityId); } Curve curve = marketData.getValue(curveId); return(RecoveryRates.of(legalEntityId, ValuationDate, curve)); }
//------------------------------------------------------------------------- public DiscountFactors discountFactors(Currency currency) { CurveId curveId = lookup.DiscountCurves.get(currency); if (curveId == null) { throw new MarketDataNotFoundException(lookup.msgCurrencyNotFound(currency)); } Curve curve = marketData.getValue(curveId); return(DiscountFactors.of(currency, ValuationDate, curve)); }
public CreditDiscountFactors discountFactors(Currency currency) { CurveId curveId = lookup.DiscountCurveIds.get(currency); if (curveId == null) { throw new MarketDataNotFoundException("Unable to find discount curve: " + currency); } Curve curve = marketData.getValue(curveId); return(CreditDiscountFactors.of(currency, ValuationDate, curve)); }
// lookup the discount factors for the legal entity group private IssuerCurveDiscountFactors issuerCurveDiscountFactors(LegalEntityGroup legalEntityGroup, Currency currency) { CurveId curveId = lookup.IssuerCurves.get(Pair.of(legalEntityGroup, currency)); if (curveId == null) { throw new MarketDataNotFoundException("Unable to find issuer curve: " + legalEntityGroup + ", " + currency); } Curve curve = marketData.getValue(curveId); DiscountFactors df = DiscountFactors.of(currency, ValuationDate, curve); return(IssuerCurveDiscountFactors.of(df, legalEntityGroup)); }
// lookup the discount factors for the repo group private RepoCurveDiscountFactors repoCurveDiscountFactors(RepoGroup repoGroup, Currency currency) { CurveId curveId = lookup.RepoCurves.get(Pair.of(repoGroup, currency)); if (curveId == null) { throw new MarketDataNotFoundException("Unable to find repo curve: " + repoGroup + ", " + currency); } Curve curve = marketData.getValue(curveId); DiscountFactors df = DiscountFactors.of(currency, ValuationDate, curve); return(RepoCurveDiscountFactors.of(df, repoGroup)); }
//------------------------------------------------------------------------- public LegalEntitySurvivalProbabilities survivalProbabilities(StandardId legalEntityId, Currency currency) { CurveId curveId = lookup.CreditCurveIds.get(Pair.of(legalEntityId, currency)); if (curveId == null) { throw new MarketDataNotFoundException("Unable to find credit curve: " + legalEntityId + ", " + currency); } Curve curve = marketData.getValue(curveId); CreditDiscountFactors survivalProbabilities = CreditDiscountFactors.of(currency, ValuationDate, curve); return(LegalEntitySurvivalProbabilities.of(legalEntityId, survivalProbabilities)); }
/// <summary> /// Function that allows user to select curve /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SelectSpline_Click(object sender, RoutedEventArgs e) { this.Hide(); ElementId selectedCurve = Helpers.HelpersSelection.PickLine(uidoc); CurveId = selectedCurve; if (CurveId != null) { this.selectSpline.Content = "ID: " + CurveId.ToString(); this.ShowDialog(); } }
//------------------------------------------------------------------------- public ImmutableCreditRatesProvider toImmutableCreditRatesProvider() { LocalDate valuationDate = ValuationDate; // credit curves IDictionary <Pair <StandardId, Currency>, LegalEntitySurvivalProbabilities> creditCurves = new Dictionary <Pair <StandardId, Currency>, LegalEntitySurvivalProbabilities>(); foreach (Pair <StandardId, Currency> pair in lookup.CreditCurveIds.Keys) { CurveId curveId = lookup.CreditCurveIds.get(pair); if (marketData.containsValue(curveId)) { Curve curve = marketData.getValue(curveId); CreditDiscountFactors survivalProbabilities = CreditDiscountFactors.of(pair.Second, valuationDate, curve); creditCurves[pair] = LegalEntitySurvivalProbabilities.of(pair.First, survivalProbabilities); } } // discount curves IDictionary <Currency, CreditDiscountFactors> discountCurves = new Dictionary <Currency, CreditDiscountFactors>(); foreach (Currency currency in lookup.DiscountCurveIds.Keys) { CurveId curveId = lookup.DiscountCurveIds.get(currency); if (marketData.containsValue(curveId)) { Curve curve = marketData.getValue(curveId); discountCurves[currency] = CreditDiscountFactors.of(currency, valuationDate, curve); } } // recovery rate curves IDictionary <StandardId, RecoveryRates> recoveryRateCurves = new Dictionary <StandardId, RecoveryRates>(); foreach (StandardId legalEntityId in lookup.RecoveryRateCurveIds.Keys) { CurveId curveId = lookup.RecoveryRateCurveIds.get(legalEntityId); if (marketData.containsValue(curveId)) { Curve curve = marketData.getValue(curveId); RecoveryRates recoveryRate = RecoveryRates.of(legalEntityId, valuationDate, curve); recoveryRateCurves[legalEntityId] = recoveryRate; } } // build result return(ImmutableCreditRatesProvider.builder().valuationDate(valuationDate).creditCurves(creditCurves).discountCurves(discountCurves).recoveryRateCurves(recoveryRateCurves).build()); }
// semi-parallel gamma PV01 for one scenario private CurrencyParameterSensitivities pv01SemiParallelGammaBucketed(ResolvedSwapTrade trade, RatesMarketData marketData) { // find the curve identifiers and resolve to a single curve ResolvedSwap product = trade.Product; if (product.CrossCurrency) { throw new System.ArgumentException("Implementation only supports a single curve, but swap is cross-currency"); } Currency currency = product.Legs.get(0).Currency; ISet <Index> indices = product.allIndices(); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: com.google.common.collect.ImmutableSet<com.opengamma.strata.data.MarketDataId<?>> discountIds = marketData.getLookup().getDiscountMarketDataIds(currency); ImmutableSet <MarketDataId <object> > discountIds = marketData.Lookup.getDiscountMarketDataIds(currency); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: com.google.common.collect.ImmutableSet<com.opengamma.strata.data.MarketDataId<?>> forwardIds = indices.stream().flatMap(idx -> marketData.getLookup().getForwardMarketDataIds(idx).stream()).collect(toImmutableSet()); ImmutableSet <MarketDataId <object> > forwardIds = indices.stream().flatMap(idx => marketData.Lookup.getForwardMarketDataIds(idx).stream()).collect(toImmutableSet()); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.Set<com.opengamma.strata.data.MarketDataId<?>> allIds = com.google.common.collect.Sets.union(discountIds, forwardIds); ISet <MarketDataId <object> > allIds = Sets.union(discountIds, forwardIds); if (allIds.Count != 1) { throw new System.ArgumentException(Messages.format("Implementation only supports a single curve, but lookup refers to more than one: {}", allIds)); } //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: com.opengamma.strata.data.MarketDataId<?> singleId = allIds.iterator().next(); MarketDataId <object> singleId = allIds.GetEnumerator().next(); if (!(singleId is CurveId)) { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: throw new System.ArgumentException(Messages.format("Implementation only supports a single curve, but lookup does not refer to a curve: {} {}", singleId.GetType().FullName, singleId)); } CurveId curveId = (CurveId)singleId; Curve curve = marketData.MarketData.getValue(curveId); // calculate gamma CurrencyParameterSensitivity gamma = CurveGammaCalculator.DEFAULT.calculateSemiParallelGamma(curve, currency, c => calculateCurveSensitivity(trade, marketData, curveId, c)); return(CurrencyParameterSensitivities.of(gamma).multipliedBy(ONE_BASIS_POINT * ONE_BASIS_POINT)); }
private void loadRatesCurves(ImmutableMarketDataBuilder builder, LocalDate marketDataDate) { if (!subdirectoryExists(CURVES_DIR)) { log.debug("No rates curves directory found"); return; } ResourceLocator curveGroupsResource = getResource(CURVES_DIR, CURVES_GROUPS_FILE); if (curveGroupsResource == null) { log.error("Unable to load rates curves: curve groups file not found at {}/{}", CURVES_DIR, CURVES_GROUPS_FILE); return; } ResourceLocator curveSettingsResource = getResource(CURVES_DIR, CURVES_SETTINGS_FILE); if (curveSettingsResource == null) { log.error("Unable to load rates curves: curve settings file not found at {}/{}", CURVES_DIR, CURVES_SETTINGS_FILE); return; } try { ICollection <ResourceLocator> curvesResources = RatesCurvesResources; IList <RatesCurveGroup> ratesCurves = RatesCurvesCsvLoader.load(marketDataDate, curveGroupsResource, curveSettingsResource, curvesResources); foreach (RatesCurveGroup group in ratesCurves) { // add entry for higher level discount curve name group.DiscountCurves.forEach((ccy, curve) => builder.addValue(CurveId.of(group.Name, curve.Name), curve)); // add entry for higher level forward curve name group.ForwardCurves.forEach((idx, curve) => builder.addValue(CurveId.of(group.Name, curve.Name), curve)); } } catch (Exception e) { log.error("Error loading rates curves", e); } }
//------------------------------------------------------------------------- public virtual void presentValueVanillaFixedVsLibor1mSwap() { SwapLeg payLeg = fixedLeg(LocalDate.of(2014, 9, 12), LocalDate.of(2016, 9, 12), Frequency.P6M, PayReceive.PAY, NOTIONAL, 0.0125, null); SwapLeg receiveLeg = RateCalculationSwapLeg.builder().payReceive(RECEIVE).accrualSchedule(PeriodicSchedule.builder().startDate(LocalDate.of(2014, 9, 12)).endDate(LocalDate.of(2016, 9, 12)).frequency(Frequency.P1M).businessDayAdjustment(BDA_MF).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.P1M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(NOTIONAL).calculation(IborRateCalculation.builder().index(USD_LIBOR_1M).fixingDateOffset(DaysAdjustment.ofBusinessDays(-2, CalendarUSD.NYC, BDA_P)).build()).build(); SwapTrade trade = SwapTrade.builder().info(TradeInfo.builder().tradeDate(LocalDate.of(2014, 9, 10)).build()).product(Swap.of(payLeg, receiveLeg)).build(); CurveGroupName groupName = CurveGroupName.of("Test"); CurveId idUsdDsc = CurveId.of(groupName, StandardDataSets.GROUP1_USD_DSC.Name); CurveId idUsdOn = CurveId.of(groupName, StandardDataSets.GROUP1_USD_ON.Name); CurveId idUsdL1M = CurveId.of(groupName, StandardDataSets.GROUP1_USD_L1M.Name); CurveId idUsdL3M = CurveId.of(groupName, StandardDataSets.GROUP1_USD_L3M.Name); CurveId idUsdL6M = CurveId.of(groupName, StandardDataSets.GROUP1_USD_L6M.Name); MarketData suppliedData = ImmutableMarketData.builder(VAL_DATE).addValue(idUsdDsc, StandardDataSets.GROUP1_USD_DSC).addValue(idUsdOn, StandardDataSets.GROUP1_USD_ON).addValue(idUsdL1M, StandardDataSets.GROUP1_USD_L1M).addValue(idUsdL3M, StandardDataSets.GROUP1_USD_L3M).addValue(idUsdL6M, StandardDataSets.GROUP1_USD_L6M).build(); CalculationFunctions functions = StandardComponents.calculationFunctions(); RatesMarketDataLookup ratesLookup = RatesMarketDataLookup.of(ImmutableMap.of(USD, idUsdDsc), ImmutableMap.of(USD_FED_FUND, idUsdOn, USD_LIBOR_1M, idUsdL1M, USD_LIBOR_3M, idUsdL3M, USD_LIBOR_6M, idUsdL6M)); // create the calculation runner IList <SwapTrade> trades = ImmutableList.of(trade); IList <Column> columns = ImmutableList.of(Column.of(Measures.PRESENT_VALUE)); CalculationRules rules = CalculationRules.of(functions, USD, ratesLookup); // calculate results using the runner // using the direct executor means there is no need to close/shutdown the runner CalculationRunner runner = CalculationRunner.of(MoreExecutors.newDirectExecutorService()); Results results = runner.calculate(rules, trades, columns, suppliedData, REF_DATA); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: com.opengamma.strata.collect.result.Result<?> result = results.get(0, 0); Result <object> result = results.get(0, 0); assertThat(result).Success; CurrencyAmount pv = (CurrencyAmount)result.Value; assertThat(pv.Amount).isCloseTo(-1003684.8402, offset(TOLERANCE_PV)); }
//------------------------------------------------------------------------- public FunctionRequirements requirements(StandardId legalEntityId, Currency currency) { CurveId creditCurveId = creditCurveIds.get(Pair.of(legalEntityId, currency)); if (creditCurveId == null) { throw new System.ArgumentException(Messages.format("Credit rates lookup has no credit curve defined for '{}' and '{}'", legalEntityId, currency)); } CurveId discountCurveId = discountCurveIds.get(currency); if (discountCurveId == null) { throw new System.ArgumentException(Messages.format("Credit rates lookup has no discount curve defined for '{}'", currency)); } CurveId recoveryRateCurveId = recoveryRateCurveIds.get(legalEntityId); if (recoveryRateCurveId == null) { throw new System.ArgumentException(Messages.format("Credit rates lookup has no recovery rate curve defined for '{}'", legalEntityId)); } return(FunctionRequirements.builder().valueRequirements(ImmutableSet.of(creditCurveId, discountCurveId, recoveryRateCurveId)).outputCurrencies(currency).observableSource(observableSource).build()); }
// calculates the sensitivity private CurrencyParameterSensitivity calculateCurveSensitivity(ResolvedFraTrade trade, RatesMarketData marketData, CurveId curveId, Curve bumpedCurve) { MarketData bumpedMarketData = marketData.MarketData.withValue(curveId, bumpedCurve); RatesProvider bumpedRatesProvider = marketData.withMarketData(bumpedMarketData).ratesProvider(); PointSensitivities pointSensitivities = tradePricer.presentValueSensitivity(trade, bumpedRatesProvider); CurrencyParameterSensitivities paramSensitivities = bumpedRatesProvider.parameterSensitivity(pointSensitivities); return(Iterables.getOnlyElement(paramSensitivities.Sensitivities)); }
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); }
/// <summary> /// Tests calibration a curve containing FRAs and pricing the curve instruments using the curve. /// </summary> public virtual void roundTripFra() { InterpolatedNodalCurveDefinition curveDefn = CurveTestUtils.fraCurveDefinition(); //JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter: IList <FraCurveNode> nodes = curveDefn.Nodes.Select(typeof(FraCurveNode).cast).collect(toImmutableList()); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.List<com.opengamma.strata.data.MarketDataId<?>> keys = nodes.stream().map(CurveTestUtils::key).collect(toImmutableList()); //JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter: IList <MarketDataId <object> > keys = nodes.Select(CurveTestUtils.key).collect(toImmutableList()); //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(keys.get(0), 0.003).put(keys.get(1), 0.0033).put(keys.get(2), 0.0037).put(keys.get(3), 0.0054).put(keys.get(4), 0.007).put(keys.get(5), 0.0091).put(keys.get(6), 0.0134).build(); IDictionary <MarketDataId <object>, double> inputData = ImmutableMap.builder <MarketDataId <object>, double>().put(keys[0], 0.003).put(keys[1], 0.0033).put(keys[2], 0.0037).put(keys[3], 0.0054).put(keys[4], 0.007).put(keys[5], 0.0091).put(keys[6], 0.0134).build(); CurveGroupName groupName = CurveGroupName.of("Curve Group"); CurveName curveName = CurveName.of("FRA Curve"); RatesCurveInputs curveInputs = RatesCurveInputs.of(inputData, DefaultCurveMetadata.of(curveName)); 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); 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)); // The PV should be zero for an instrument used to build the curve nodes.ForEach(node => checkFraPvIsZero(node, ratesProvider, marketData)); }