Exemplo n.º 1
0
        public virtual void test_of()
        {
            CmsSabrExtrapolationParams test = CmsSabrExtrapolationParams.of(1d, 2d);

            assertEquals(test.CutOffStrike, 1d);
            assertEquals(test.Mu, 2d);
        }
Exemplo n.º 2
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            CmsSabrExtrapolationParams test = CmsSabrExtrapolationParams.of(1d, 2d);

            coverImmutableBean(test);
            CmsSabrExtrapolationParams test2 = CmsSabrExtrapolationParams.of(3d, 4d);

            coverBeanEquals(test, test2);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates an instance.
        /// </summary>
        /// <param name="cmsParams">  the CMS parameters </param>
        internal CmsMeasureCalculations(CmsSabrExtrapolationParams cmsParams)
        {
            SabrExtrapolationReplicationCmsPeriodPricer  periodPricer  = SabrExtrapolationReplicationCmsPeriodPricer.of(cmsParams.CutOffStrike, cmsParams.Mu);
            SabrExtrapolationReplicationCmsLegPricer     legPricer     = new SabrExtrapolationReplicationCmsLegPricer(periodPricer);
            SabrExtrapolationReplicationCmsProductPricer productPricer = new SabrExtrapolationReplicationCmsProductPricer(legPricer);
            SabrExtrapolationReplicationCmsTradePricer   tradePricer   = new SabrExtrapolationReplicationCmsTradePricer(productPricer);

            this.tradePricer = ArgChecker.notNull(tradePricer, "tradePricer");
        }
 //-----------------------------------------------------------------------
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         CmsSabrExtrapolationParams other = (CmsSabrExtrapolationParams)obj;
         return(JodaBeanUtils.equal(cutOffStrike, other.cutOffStrike) && JodaBeanUtils.equal(mu, other.mu));
     }
     return(false);
 }
        //-------------------------------------------------------------------------
//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);
        }
Exemplo n.º 6
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);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Obtains an instance specifying the SABR extrapolation parameters.
 /// </summary>
 /// <param name="cmsParams">  the parameters for SABR pricing of CMS </param>
 /// <returns> the trade calculations </returns>
 public static CmsTradeCalculations of(CmsSabrExtrapolationParams cmsParams)
 {
     return(new CmsTradeCalculations(cmsParams));
 }
Exemplo n.º 8
0
        public virtual void test_serialization()
        {
            CmsSabrExtrapolationParams test = CmsSabrExtrapolationParams.of(1d, 2d);

            assertSerialization(test);
        }