コード例 #1
0
        public static double LinearRateModel_OisRateComplex(string modelName, string oisSwapName)
        {
            LinearRateModel model = ObjectMap.LinearRateModels[modelName];
            OisSwap         swap  = (OisSwap)ObjectMap.LinearRateInstruments[oisSwapName];

            return(model.DiscCurve.OisRate(swap, InterpMethod.Hermite));
        }
コード例 #2
0
        public static void RiskJacobian_Make(string baseHandle, string linearRateModelHandle, DateTime asOf, string[] calibSetsHandles, string[] curveTenors, bool useAd = false)
        {
            LinearRateModel model    = ObjectMap.LinearRateModels[linearRateModelHandle];
            RiskJacobian    jacobian = new RiskJacobian(model, asOf);

            if (calibSetsHandles.Length != curveTenors.Length)
            {
                throw new InvalidOperationException("CurveTenor and Calibration set handles must have same dimension.");
            }

            for (int i = 0; i < calibSetsHandles.Length; i++)
            {
                jacobian.AddInstruments(ObjectMap.CalibrationInstrumentSets[calibSetsHandles[i]], StrToEnum.CurveTenorConvert(curveTenors[i]));
            }

            // Using this procedure, the instruments are actually sorted.
            jacobian.Initialize();

            if (useAd)
            {
                // Construct using AD
                jacobian.ConstructUsingAD();
            }
            else
            {
                jacobian.ConstructUsingBumpAndRun();
            }

            ObjectMap.RiskJacobians[baseHandle] = jacobian;
        }
コード例 #3
0
        public static double LinearRateModel_BasisSwapValue(string baseName, string swapName)
        {
            LinearRateModel model = ObjectMap.LinearRateModels[baseName];
            TenorBasisSwap  swap  = (TenorBasisSwap)ObjectMap.LinearRateInstruments[swapName];

            return(model.BasisSwapNpv(swap));
        }
コード例 #4
0
        public static double LinearRateModel_BasisParSpread(string modelName, string basisSwapName)
        {
            LinearRateModel model = ObjectMap.LinearRateModels[modelName];
            TenorBasisSwap  swap  = (TenorBasisSwap)ObjectMap.LinearRateInstruments[basisSwapName];

            return(model.ParBasisSpread(swap));
        }
コード例 #5
0
        public static double LinearRateModel_FloatLegValue(string baseName, string floatLegName)
        {
            LinearRateModel model    = ObjectMap.LinearRateModels[baseName];
            FloatLeg        fixedLeg = ObjectMap.FloatLegs[floatLegName];

            return(model.ValueFloatLeg(fixedLeg));
        }
コード例 #6
0
        public static double LinearRateModel_SwapParRate(string baseName, string swapName)
        {
            LinearRateModel model = ObjectMap.LinearRateModels[baseName];
            IrSwap          swap  = (IrSwap)ObjectMap.LinearRateInstruments[swapName];

            return(model.IrParSwapRate(swap));
        }
コード例 #7
0
        public static double LinearRateModel_Value(string linearRateModelHandle, string productHandle)
        {
            LinearRateInstrument product = ObjectMap.LinearRateInstruments[productHandle];
            LinearRateModel      model   = ObjectMap.LinearRateModels[linearRateModelHandle];

            return(model.ValueLinearRateProduct(product));
        }
コード例 #8
0
        public static object[,] ZcbRiskAD(string linearRateModelHandle, string productHandle)
        {
            LinearRateModel      model   = ObjectMap.LinearRateModels[linearRateModelHandle];
            LinearRateInstrument product = ObjectMap.LinearRateInstruments[productHandle];

            return(model.CreateTestOutputAD(product));
        }
コード例 #9
0
        public static void InstrumentFactory_UpdateAllInstrumentsToPar(string baseName, string modelHandle)
        {
            LinearRateModel   model   = ObjectMap.LinearRateModels[modelHandle];
            InstrumentFactory factory = ObjectMap.InstrumentFactories[baseName];

            factory.UpdateAllInstrumentsToParGivenModel(model);
        }
コード例 #10
0
        public static void LinearRateModel_Make(string baseName, string fwdCurveCollectionName, string discCurveName, InterpMethod interpolation)
        {
            FwdCurveContainer fwdCurves = ObjectMap.FwdCurveCollections[fwdCurveCollectionName];
            Curve             discCurve = ObjectMap.DiscCurves[discCurveName];
            LinearRateModel   model     = new LinearRateModel(discCurve, fwdCurves, interpolation);

            ObjectMap.LinearRateModels[baseName] = model;
        }
コード例 #11
0
        public static void RiskEngineNew_Make(string baseHandle, string portfolioHandle, string riskJacobianHandle, bool useAd)
        {
            RiskJacobian    jacobian    = ObjectMap.RiskJacobians[riskJacobianHandle];
            double          determinant = jacobian.Jacobian.Determinant();
            LinearRateModel model       = jacobian.Model;
            Portfolio       portfolio   = ObjectMap.Portfolios[portfolioHandle];

            ObjectMap.RiskEngines[baseHandle] = new RiskEngine(model, portfolio, jacobian, useAd);
        }