// 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.cms.ResolvedCmsTrade trade, CmsMeasureCalculations calculations, com.opengamma.strata.measure.rate.RatesScenarioMarketData ratesMarketData, com.opengamma.strata.measure.swaption.SwaptionScenarioMarketData swaptionMarketData)
        private Result <object> calculate(Measure measure, ResolvedCmsTrade trade, CmsMeasureCalculations calculations, RatesScenarioMarketData ratesMarketData, SwaptionScenarioMarketData swaptionMarketData)
        {
            SingleMeasureCalculation calculator = CALCULATORS.get(measure);

            if (calculator == null)
            {
                return(Result.failure(FailureReason.UNSUPPORTED, "Unsupported measure for SwaptionTrade: {}", measure));
            }
            return(Result.of(() => calculator(calculations, trade, ratesMarketData, swaptionMarketData)));
        }
        //-------------------------------------------------------------------------
//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.cms.CmsTrade 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(CmsTrade trade, ISet <Measure> measures, CalculationParameters parameters, ScenarioMarketData scenarioMarketData, ReferenceData refData)
        {
            // expand the trade once for all measures and all scenarios
            ResolvedCmsTrade           resolved           = trade.resolve(refData);
            RatesMarketDataLookup      ratesLookup        = parameters.getParameter(typeof(RatesMarketDataLookup));
            RatesScenarioMarketData    ratesMarketData    = ratesLookup.marketDataView(scenarioMarketData);
            SwaptionMarketDataLookup   swaptionLookup     = parameters.getParameter(typeof(SwaptionMarketDataLookup));
            SwaptionScenarioMarketData swaptionMarketData = swaptionLookup.marketDataView(scenarioMarketData);
            CmsSabrExtrapolationParams cmsParams          = parameters.getParameter(typeof(CmsSabrExtrapolationParams));
            CmsMeasureCalculations     calculations       = new CmsMeasureCalculations(cmsParams);

            // 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, calculations, ratesMarketData, swaptionMarketData);
            }
            return(results);
        }
Esempio n. 3
0
 /// <summary>
 /// Creates an instance specifying the SABR pricer.
 /// </summary>
 /// <param name="tradePricer">  the pricer for <seealso cref="ResolvedCmsTrade"/> </param>
 public CmsTradeCalculations(SabrExtrapolationReplicationCmsTradePricer tradePricer)
 {
     this.calc = new CmsMeasureCalculations(tradePricer);
 }
Esempio n. 4
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Creates an instance specifying the SABR extrapolation parameters.
 /// </summary>
 /// <param name="cmsParams">  the parameters for SABR pricing of CMS </param>
 private CmsTradeCalculations(CmsSabrExtrapolationParams cmsParams)
 {
     this.calc = new CmsMeasureCalculations(cmsParams);
 }