예제 #1
0
        /// <summary>
        /// Get the Calibration status for the calibration engine using
        /// the expiry/tenor pair
        /// </summary>
        /// <param name="engineHandle">The calibration engine handle</param>
        /// <returns></returns>
        public bool IsSABRModelCalibrated(string engineHandle)
        {
            if (!_sabrEngines.ContainsKey(engineHandle))
            {
                return(false);
            }
            SmileCalibrationEngine smileEngine = _sabrEngines[engineHandle];
            var calibrationEngine = smileEngine.SABRCalibrationEngine;

            return(calibrationEngine.IsSABRModelCalibrated);
        }
예제 #2
0
        /// <summary>
        /// Get the Calibration Engine Calibration Error the expiry/tenor pair
        /// </summary>
        /// <param name="engineHandle">The calibration engine handle</param>
        /// <returns></returns>
        public decimal SABRCalibrationError(string engineHandle)
        {
            if (!_sabrEngines.ContainsKey(engineHandle))
            {
                throw new ArgumentException("SABR Smile Calibration engine not found.");
            }
            SmileCalibrationEngine smileEngine = _sabrEngines[engineHandle];
            var calibrationEngine = smileEngine.SABRCalibrationEngine;

            return(calibrationEngine.CalibrationError);
        }
예제 #3
0
        /// <summary>
        /// Create a SABR CapFloor Calibration Engine
        /// </summary>
        /// <param name="engineHandle">The handle for this engine</param>
        /// <param name="settingsHandle">The handle to the settings object we use for this calibration</param>
        /// <param name="bootstrapFixedStrikeHandle">The fixed strike engines to use as a base</param>
        /// <param name="bootstrapATMHandle">The ATM engine used in Calibration</param>
        /// <returns>The handle of this engine</returns>
        public string SABRCalibrationEngine(string engineHandle, string settingsHandle, string bootstrapFixedStrikeHandle, string bootstrapATMHandle)
        {
            // The ATM CapFloor bootstrap engine is the 0th strike CapFloor engine with this handle
            VolatilityCurve atmEngine;

            if (_volCurveEngines.ContainsKey(bootstrapATMHandle))
            {
                atmEngine = _volCurveEngines[bootstrapATMHandle][0];
            }
            else
            {
                throw new ArgumentException("ATM Bootstrap engine not found.");
            }
            SortedList <decimal, VolatilityCurve> fixedStrikeEngines;

            if (_volCurveEngines.ContainsKey(bootstrapFixedStrikeHandle))
            {
                fixedStrikeEngines = _volCurveEngines[bootstrapFixedStrikeHandle];
            }
            else
            {
                throw new ArgumentException("Fixed Strike Bootstrap engines not found.");
            }
            SmileCalibrationSettings settings;

            if (_sabrSettings.ContainsKey(settingsHandle))
            {
                settings = _sabrSettings[settingsHandle];
            }
            else
            {
                throw new ArgumentException("Smile Settings not found.");
            }
            var engine = new SmileCalibrationEngine(atmEngine, settings, new List <VolatilityCurve>(fixedStrikeEngines.Values), engineHandle);

            if (_sabrEngines.ContainsKey(engineHandle))
            {
                _sabrEngines[engineHandle] = engine;
            }
            else
            {
                _sabrEngines.Add(engineHandle, engine);
            }
            return(engineHandle);
        }