Esempio n. 1
0
 public BlackVanillaOptionPricer(double forwardValue, Date expiryDate, Period swapTenor, SwaptionVolatilityStructure volatilityStructure) {
     forwardValue_ = forwardValue;
     expiryDate_ = expiryDate;
     swapTenor_ = swapTenor;
     volatilityStructure_ = volatilityStructure;
     smile_ = volatilityStructure_.smileSection(expiryDate_, swapTenor_);
 }
Esempio n. 2
0
 public BlackVanillaOptionPricer(double forwardValue, Date expiryDate, Period swapTenor, SwaptionVolatilityStructure volatilityStructure)
 {
     _forwardValue = forwardValue;
     _expiryDate = expiryDate;
     _swapTenor = swapTenor;
     _volatilityStructure = volatilityStructure;
     _smile = _volatilityStructure.smileSection(_expiryDate, _swapTenor);
 }
Esempio n. 3
0
 public BlackVanillaOptionPricer(double forwardValue, Date expiryDate, Period swapTenor, SwaptionVolatilityStructure volatilityStructure)
 {
     forwardValue_        = forwardValue;
     expiryDate_          = expiryDate;
     swapTenor_           = swapTenor;
     volatilityStructure_ = volatilityStructure;
     smile_ = volatilityStructure_.smileSection(expiryDate_, swapTenor_);
 }
 public BlackVanillaOptionPricer(double forwardValue, Date expiryDate, Period swapTenor, SwaptionVolatilityStructure volatilityStructure)
 {
     _forwardValue        = forwardValue;
     _expiryDate          = expiryDate;
     _swapTenor           = swapTenor;
     _volatilityStructure = volatilityStructure;
     _smile = _volatilityStructure.smileSection(_expiryDate, _swapTenor);
 }
Esempio n. 5
0
        public BlackVanillaOptionPricer(double forwardValue, Date expiryDate, Period swapTenor, SwaptionVolatilityStructure volatilityStructure)
        {
            forwardValue_        = forwardValue;
            expiryDate_          = expiryDate;
            swapTenor_           = swapTenor;
            volatilityStructure_ = volatilityStructure;
            smile_ = volatilityStructure_.smileSection(expiryDate_, swapTenor_);

            Utils.QL_REQUIRE(volatilityStructure.volatilityType() == VolatilityType.ShiftedLognormal &&
                             Utils.close_enough(volatilityStructure.shift(expiryDate, swapTenor), 0.0), () =>
                             "BlackVanillaOptionPricer: zero-shift lognormal volatility required");
        }
            // utilities
            public void makeObservabilityTest(  string description,
                                                SwaptionVolatilityStructure vol,
                                                bool mktDataFloating,
                                                bool referenceDateFloating)
            {
                double dummyStrike = .02;
                Date referenceDate = Settings.evaluationDate();
                double initialVol = vol.volatility(
                        referenceDate + atm.tenors.options[0],
                        atm.tenors.swaps[0], dummyStrike, false);
                // testing evaluation date change ...
                Settings.setEvaluationDate(referenceDate - new Period(1, TimeUnit.Years));
                double newVol =  vol.volatility(
                                        referenceDate + atm.tenors.options[0],
                        atm.tenors.swaps[0], dummyStrike, false);

                Settings.setEvaluationDate(referenceDate);
                if (referenceDateFloating && (initialVol == newVol))
                    Assert.Fail(description +
                            " the volatility should change when the reference date is changed !");
                if (!referenceDateFloating && (initialVol != newVol))
                    Assert.Fail(description +
                            " the volatility should not change when the reference date is changed !");

                // test market data change...
                if (mktDataFloating)
                {
                    double initialVolatility = atm.volsHandle[0][0].link.value();

                    SimpleQuote sq=(SimpleQuote)(atm.volsHandle[0][0].currentLink());
                    sq.setValue(10);

                    newVol = vol.volatility(referenceDate + atm.tenors.options[0],
                                            atm.tenors.swaps[0], dummyStrike, false);
                    sq.setValue(initialVolatility);

                if (initialVol == newVol)
                    Assert.Fail(description + " the volatility should change when"+
                                " the market data is changed !");
                }
            }