Пример #1
0
        public override Excel_underlyingModel_paraViewModel underModel(Excel_underlyingInfoViewModel excel_uivm, Excel_instrumentViewModel excel_instrumentViewModel, DateTime dateTime)
        {
            Excel_hullWhiteOneFactorViewModel e_hwofvm = new Excel_hullWhiteOneFactorViewModel();

            Excel_interestRateViewModel e_irvm = excel_uivm as Excel_interestRateViewModel;

            string value = Excel_loaderViewModel.loadMarketData(dateTime, excel_uivm.Excel_type_, excel_uivm.KrCode_);

            e_hwofvm.CurrentValue_ = value;

            e_hwofvm.Alpha_      = this.HullWhite_AlphaSetting_.value(dateTime, excel_instrumentViewModel, excel_uivm);
            e_hwofvm.Volatility_ = this.HullWhite_SigmaSetting_.value(dateTime, excel_instrumentViewModel, excel_uivm);

            e_hwofvm.setInterestRateInfo(e_irvm);

            e_hwofvm.Excel_yieldCurveViewModel_ = this.HullWhite_FittingCurveSetting_.value(dateTime, excel_instrumentViewModel, excel_uivm);

            return(e_hwofvm);
        }
        public Excel_underlyingInfo_paraViewModel getUnderlyingParameterModel(Excel_underlyingInfoViewModel e_uivm)
        {
            Excel_underlyingInfo_paraViewModel e_uipvm = new Excel_underlyingInfo_paraViewModel();

            if (e_uivm.Excel_type_.ToUpper() == "STOCK")
            {
                e_uipvm.KrCode_ = e_uivm.KrCode_;
                //e_uipvm.UnderName_ = e_uivm.Name_;
                //e_uipvm.Model_ = "GBM";

                Excel_geometricBMViewModel e_gbmvm = new Excel_geometricBMViewModel();

                e_gbmvm.Code_ = e_uivm.KrCode_;

                e_uipvm.Excel_underlyingModel_paraViewModel_ = e_gbmvm;

            }
            else if (e_uivm.Excel_type_.ToUpper() == "INTERESTRATE")
            {
                e_uipvm.KrCode_ = e_uivm.KrCode_;
                //e_uipvm.UnderName_ = e_uivm.Name_;
                //e_uipvm.Model_ = "HullWhiteOne";

                Excel_hullWhiteOneFactorViewModel e_hwofvm = new Excel_hullWhiteOneFactorViewModel();

                Excel_interestRateViewModel e_irvm = e_uivm as Excel_interestRateViewModel;

                e_hwofvm.Code_ = e_uivm.KrCode_;

                e_hwofvm.setInterestRateInfo(e_irvm);

                e_uipvm.Excel_underlyingModel_paraViewModel_ = e_hwofvm;
            }
            else
            {
                throw new NotImplementedException();
            }

            e_uipvm.Excel_underlyingModel_paraViewModel_.parameterLoad(
                this.ParameterSettingManager_);

            return e_uipvm;
        }
Пример #3
0
        public Excel_underlyingInfo_paraViewModel getUnderlyingParameterModel(Excel_underlyingInfoViewModel e_uivm)
        {
            Excel_underlyingInfo_paraViewModel e_uipvm = new Excel_underlyingInfo_paraViewModel();

            if (e_uivm.Excel_type_.ToUpper() == "STOCK")
            {
                e_uipvm.KrCode_ = e_uivm.KrCode_;
                //e_uipvm.UnderName_ = e_uivm.Name_;
                //e_uipvm.Model_ = "GBM";

                Excel_geometricBMViewModel e_gbmvm = new Excel_geometricBMViewModel();

                e_gbmvm.Code_ = e_uivm.KrCode_;

                e_uipvm.Excel_underlyingModel_paraViewModel_ = e_gbmvm;
            }
            else if (e_uivm.Excel_type_.ToUpper() == "INTERESTRATE")
            {
                e_uipvm.KrCode_ = e_uivm.KrCode_;
                //e_uipvm.UnderName_ = e_uivm.Name_;
                //e_uipvm.Model_ = "HullWhiteOne";

                Excel_hullWhiteOneFactorViewModel e_hwofvm = new Excel_hullWhiteOneFactorViewModel();

                Excel_interestRateViewModel e_irvm = e_uivm as Excel_interestRateViewModel;

                e_hwofvm.Code_ = e_uivm.KrCode_;

                e_hwofvm.setInterestRateInfo(e_irvm);

                e_uipvm.Excel_underlyingModel_paraViewModel_ = e_hwofvm;
            }
            else
            {
                throw new NotImplementedException();
            }

            e_uipvm.Excel_underlyingModel_paraViewModel_.parameterLoad(
                this.ParameterSettingManager_);

            return(e_uipvm);
        }
        public string set_hullWhiteModel(string underCode, double currentValue, double alpha, double sigma, YieldTermStructure fittingCurve)
        {
            try
            {
                Excel_standardSwapParaViewModel e_sspvm = this.InstVM_.Excel_parameterViewModel_ as Excel_standardSwapParaViewModel;

                // under 에서 tenor를 가져옴
                string tenor = "3M"; // defaultrrrr
                
                bool setFlag = false;

                Excel_hullWhiteOneFactorViewModel e_hwvm = new Excel_hullWhiteOneFactorViewModel();

                foreach (var item in e_sspvm.Excel_underlyingCalcInfo_paraViewModel_.Excel_underlyingInfo_paraViewModel_)
                {
                    if (underCode == item.KrCode_)
                    {
                        e_hwvm.CurrentValue_ = currentValue.ToString();

                        e_hwvm.Alpha_ = alpha.ToString();
                        e_hwvm.Volatility_ = sigma.ToString();

                        e_hwvm.Excel_yieldCurveViewModel_ = fittingCurve.Excel_yieldCurveViewModel_;

                        item.Excel_underlyingModel_paraViewModel_ = e_hwvm;

                        setFlag = true;

                    }
                }

                foreach (var item in this.InstVM_.Excel_interfaceViewModel_.Excel_underlyingCalcInfoViewModel_.Excel_underlyingInfoViewModel_)
                {
                    if (underCode == item.KrCode_)
                    {
                        Excel_interestRateViewModel e_irvm = item as Excel_interestRateViewModel;

                        e_hwvm.setInterestRateInfo(e_irvm);
                    }
                }

                if (!setFlag)
                {
                    throw new Exception(underCode + " doesn't exist");
                }

                return "set hullWhit_model complete : " + underCode;
            }
            catch (Exception e)
            {
                return "set fail : " + e.Message;
            }
        }