// calculate one measure //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: private com.opengamma.strata.collect.result.Result<?> calculate(com.opengamma.strata.calc.Measure measure, com.opengamma.strata.product.fxopt.ResolvedFxVanillaOptionTrade trade, com.opengamma.strata.measure.rate.RatesScenarioMarketData ratesMarketData, FxOptionScenarioMarketData optionMarketData, FxVanillaOptionMethod method) private Result <object> calculate(Measure measure, ResolvedFxVanillaOptionTrade trade, RatesScenarioMarketData ratesMarketData, FxOptionScenarioMarketData optionMarketData, FxVanillaOptionMethod method) { SingleMeasureCalculation calculator = CALCULATORS.get(measure); if (calculator == null) { return(Result.failure(FailureReason.UNSUPPORTED, "Unsupported measure for FxVanillaOptionTrade: {}", measure)); } return(Result.of(() => calculator(trade, ratesMarketData, optionMarketData, method))); }
//------------------------------------------------------------------------- //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: @Override public java.util.Map<com.opengamma.strata.calc.Measure, com.opengamma.strata.collect.result.Result<?>> calculate(com.opengamma.strata.product.fxopt.FxVanillaOptionTrade trade, java.util.Set<com.opengamma.strata.calc.Measure> measures, com.opengamma.strata.calc.runner.CalculationParameters parameters, com.opengamma.strata.data.scenario.ScenarioMarketData scenarioMarketData, com.opengamma.strata.basics.ReferenceData refData) public virtual IDictionary <Measure, Result <object> > calculate(FxVanillaOptionTrade trade, ISet <Measure> measures, CalculationParameters parameters, ScenarioMarketData scenarioMarketData, ReferenceData refData) { // expand the trade once for all measures and all scenarios ResolvedFxVanillaOptionTrade resolved = trade.resolve(refData); RatesMarketDataLookup ratesLookup = parameters.getParameter(typeof(RatesMarketDataLookup)); RatesScenarioMarketData ratesMarketData = ratesLookup.marketDataView(scenarioMarketData); FxOptionMarketDataLookup optionLookup = parameters.getParameter(typeof(FxOptionMarketDataLookup)); FxOptionScenarioMarketData optionMarketData = optionLookup.marketDataView(scenarioMarketData); FxVanillaOptionMethod method = parameters.findParameter(typeof(FxVanillaOptionMethod)).orElse(FxVanillaOptionMethod.BLACK); // loop around measures, calculating all scenarios for one measure //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.Map<com.opengamma.strata.calc.Measure, com.opengamma.strata.collect.result.Result<?>> results = new java.util.HashMap<>(); IDictionary <Measure, Result <object> > results = new Dictionary <Measure, Result <object> >(); foreach (Measure measure in measures) { results[measure] = calculate(measure, resolved, ratesMarketData, optionMarketData, method); } return(results); }