Ejemplo n.º 1
0
        // 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.fx.ResolvedFxNdfTrade trade, com.opengamma.strata.measure.rate.RatesScenarioMarketData marketData)
        private Result <object> calculate(Measure measure, ResolvedFxNdfTrade trade, RatesScenarioMarketData marketData)
        {
            SingleMeasureCalculation calculator = CALCULATORS.get(measure);

            if (calculator == null)
            {
                return(Result.failure(FailureReason.UNSUPPORTED, "Unsupported measure for FxNdfTrade: {}", measure));
            }
            return(Result.of(() => calculator(trade, marketData)));
        }
Ejemplo n.º 2
0
        //-------------------------------------------------------------------------
//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.fx.FxNdfTrade 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(FxNdfTrade trade, ISet <Measure> measures, CalculationParameters parameters, ScenarioMarketData scenarioMarketData, ReferenceData refData)
        {
            // resolve the trade once for all measures and all scenarios
            ResolvedFxNdfTrade resolved = trade.resolve(refData);

            // use lookup to query market data
            RatesMarketDataLookup   ratesLookup = parameters.getParameter(typeof(RatesMarketDataLookup));
            RatesScenarioMarketData marketData  = ratesLookup.marketDataView(scenarioMarketData);

            // 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, marketData);
            }
            return(results);
        }