Пример #1
0
        public static object LocalVolSurface(object mktObj, object[] dates, double[] strikes, string assetName)
        {
            return(FunctionRunnerUtils.Run("LocalVolSurface", () =>
            {
                Market market = MarketManager.Instance.GetMarket(mktObj);
                AssetMarket assetMarket = market.AssetMarketFromName(assetName);
                VolatilitySurface volSurface = assetMarket.VolSurface();
                var maturities = ObjectConverters.ConvertDateArray(dates, assetMarket.RefDate);

                return ArrayUtils.CartesianProd(maturities, strikes, volSurface.LocalVol);
            }));
        }
Пример #2
0
        public static object Bergomi2FAtmfSkewApprox(object mktObj, object[,] modelBag, object[] maturities)
        {
            return(FunctionRunnerUtils.Run("Bergomi2FAtmfSkewApprox", () =>
            {
                Market market = MarketManager.Instance.GetMarket(mktObj);
                ICalibrationDescription b2FCalibDesc = Bergomi2FModelFactoryFromBag.Instance.Build(modelBag);
                IModelDescription b2FDesc = ModelCalibration.Instance.Calibrate(b2FCalibDesc, market);
                var b2Fmodel = (Bergomi2FModel)ModelFactory.Instance.Build(b2FDesc, market);

                var mats = b2Fmodel.Time[ObjectConverters.ConvertDateArray(maturities, market.RefDate)];

                var skews = Bergomi2FUtils.AtmfSkewApprox(b2Fmodel, mats);
                return skews.AsColumn();
            }));
        }
Пример #3
0
        public static object Bergomi2FVolOfVol(object mktObj, object[,] modelBag, object[] starts, object[] ends)
        {
            return(FunctionRunnerUtils.Run("Bergomi2FVolOfVol", () =>
            {
                Market market = MarketManager.Instance.GetMarket(mktObj);
                ICalibrationDescription b2FCalibDesc = Bergomi2FModelFactoryFromBag.Instance.Build(modelBag);
                IModelDescription b2FDesc = ModelCalibration.Instance.Calibrate(b2FCalibDesc, market);
                var b2Fmodel = (Bergomi2FModel)ModelFactory.Instance.Build(b2FDesc, market);

                var startDates = b2Fmodel.Time[ObjectConverters.ConvertDateArray(starts, market.RefDate)];
                var endDates = b2Fmodel.Time[ObjectConverters.ConvertDateArray(ends, market.RefDate)];
                if (startDates.Length != endDates.Length)
                {
                    throw new ArgumentException("Incompatible size between starts and ends");
                }

                return Bergomi2FUtils.FwdVolInstantVol(b2Fmodel, startDates, endDates).AsColumn();
            }));
        }