Exemplo n.º 1
0
 //! floating reference date, floating market data
 public SwaptionVolatilityMatrix(
     Calendar calendar,
     BusinessDayConvention bdc,
     List<Period> optionTenors,
     List<Period> swapTenors,
     List<List<Handle<Quote> > > vols,
     DayCounter dayCounter)
     : base(optionTenors, swapTenors, 0, calendar, bdc, dayCounter)
 {
     volHandles_=vols;
     volatilities_ = new Matrix(vols.Count, vols.First().Count );
     checkInputs(volatilities_.rows(), volatilities_.columns());
     registerWithMarketData();
     interpolation_ =
     new BilinearInterpolation(swapLengths_, swapLengths_.Count,
     optionTimes_, optionTimes_.Count,
     volatilities_);
 }
Exemplo n.º 2
0
        //! floating reference date, fixed market data
        public SwaptionVolatilityMatrix(
            Calendar calendar,
            BusinessDayConvention bdc,
            List<Period> optionTenors,
            List<Period> swapTenors,
            Matrix vols,
            DayCounter dayCounter)
            : base(optionTenors, swapTenors, 0, calendar, bdc, dayCounter)
        {
            volHandles_ = new InitializedList<List<Handle<Quote>>>(vols.rows());
            volatilities_ = new Matrix(vols.rows(), vols.columns());
            checkInputs(vols.rows(), vols.columns());

            // fill dummy handles to allow generic handle-based
            // computations later on
            for (int i=0; i<vols.rows(); ++i) {
                volHandles_[i] = new InitializedList<Handle<Quote>>(vols.columns());
                for (int j=0; j<vols.columns(); ++j)
                    volHandles_[i][j] = new Handle<Quote>((new
                        SimpleQuote(vols[i,j])));
            }

            interpolation_ =
            new BilinearInterpolation(swapLengths_, swapLengths_.Count,
            optionTimes_, optionTimes_.Count,
            volatilities_);
        }
Exemplo n.º 3
0
 public FlatExtrapolator2D(Interpolation2D decoratedInterpolation)
 {
     impl_ = new FlatExtrapolator2DImpl(decoratedInterpolation);
 }
Exemplo n.º 4
0
 public FlatExtrapolator2DImpl(Interpolation2D decoratedInterpolation)
 {
     decoratedInterp_ = decoratedInterpolation;
     calculate();
 }
Exemplo n.º 5
0
 public void setInterpolation <Interpolator>(Interpolator i) where Interpolator : IInterpolationFactory2D, new()
 {
     varianceSurface_ = i.interpolate(times_, times_.Count, strikes_, strikes_.Count, variances_);
     varianceSurface_.update();
     notifyObservers();
 }