Ejemplo n.º 1
0
 private VolatilitySurface(ITimeMeasure time, MoneynessProvider moneyness,
                           VarianceInterpoler varianceInterpoler, LocalVariance localVariance)
 {
     Time = time;
     VarianceInterpoler = varianceInterpoler;
     Moneyness          = moneyness;
     LocalVariance      = localVariance;
 }
Ejemplo n.º 2
0
        public static VolatilitySurface BuildInterpol(VolatilityMatrix volMatrix, MoneynessProvider moneyness)
        {
            double[] timePillars = volMatrix.Time[volMatrix.Pillars];

            var varianceSlices = EnumerableUtils.For(0, timePillars.Length, i =>
            {
                double t = timePillars[i];
                double[] moneynessPillars = volMatrix.Strikes.Map(k => moneyness.Moneyness(t, k));
                var varianceSlice         = volMatrix.Vols.Row(i).Map(v => t * v * v);
                return((RrFunction)SplineInterpoler.BuildCubicSpline(moneynessPillars, varianceSlice));
            });

            var varianceInterpol = new VarianceInterpoler(timePillars, varianceSlices);

            return(new VolatilitySurface(volMatrix.Time, moneyness, varianceInterpol, varianceInterpol.BuildLocalVariance()));
        }