Esempio n. 1
0
        // product 화면에 underlying이 추가댔을 경우 그 이벤트를 받는 놈.
        public override void instrumentEventObserver(object sender, PropertyChangedEventArgs e)
        {
            Excel_underlyingCalcInfoViewModel senderVM = sender as Excel_underlyingCalcInfoViewModel;

            int count = senderVM.Excel_underlyingInfoViewModel_.Count;

            if (count > 0)
            {
                Excel_underlyingInfoViewModel e_uivm = senderVM.Excel_underlyingInfoViewModel_[count - 1];

                //// model associated type defined class
                //UnderlyingModelSetting ums = new UnderlyingModelSetting();

                // 원래 setting 해논 놈을 씀 UnderlyingModelSetting_
                Excel_underlyingInfo_paraViewModel e_uipvm =
                    this.UnderlyingModelSetting_.getUnderlyingParameterModel(e_uivm);

                this.excel_underlyingCalcInfo_paraViewModel_.
                Excel_underlyingInfo_paraViewModel_.Add(e_uipvm);

                this.excel_underlyingCalcInfo_paraViewModel_.
                Excel_correlationInfo_paraViewModel_.addUnderlying(e_uipvm.UnderNameTrans_.Value_);
            }
            else
            {
                OutputLogViewModel.addResult("input underlying num is 0");
            }
        }
        public void addDiagonal(Excel_underlyingInfo_paraViewModel e_ui_pvm)
        {
            string under = e_ui_pvm.KrCode_;

            this.underlyingList_.Add(under);

            this.dimension_ += 1;

            Excel_correlation_paraViewModel diagCorrVM = new Excel_correlation_paraViewModel();

            diagCorrVM.First_  = under;
            diagCorrVM.Second_ = under;
            diagCorrVM.Value_  = "1.0";

            this.excel_correlation_paraViewModel_.Add(diagCorrVM);
        }
        public void buildParaSetting(ParameterSettingManager paraSettingManager)
        {
            this.excel_underlyingInfo_paraViewModel_.Clear();

            Excel_underlyingCalcInfoViewModel e_ucvm = paraSettingManager.Excel_InstrumentViewModel_.Excel_interfaceViewModel_.getExcel_underlyingCalcInfoViewModel();

            foreach (var item in e_ucvm.Excel_underlyingInfoViewModel_)
            {
                Excel_underlyingInfo_paraViewModel e_uparavm = new Excel_underlyingInfo_paraViewModel();

                e_uparavm.buildParaSetting(item, paraSettingManager);

                this.excel_underlyingInfo_paraViewModel_.Add(e_uparavm);
            }

            this.excel_correlationInfo_paraViewModel_.buildParaSetting(paraSettingManager);
        }
        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;
        }
Esempio n. 5
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 void setFromSerial(FpmlSerializedCSharp.ISerialized serial_Class)
        {
            FpmlSerializedCSharp.Excel_underlyingCalcInfo_para serial_Excel_underlyingCalcInfo_para = serial_Class as FpmlSerializedCSharp.Excel_underlyingCalcInfo_para;

            List <FpmlSerializedCSharp.Excel_underlyingInfo_para> serial_excel_underlyingInfo_para = serial_Excel_underlyingCalcInfo_para.Excel_underlyingInfo_para_;

            this.excel_underlyingInfo_paraViewModel_ = new ObservableCollection <Excel_underlyingInfo_paraViewModel>();
            foreach (var item in serial_excel_underlyingInfo_para)
            {
                string type = item.Excel_type_.ValueStr;
                Excel_underlyingInfo_paraViewModel viewModel = new Excel_underlyingInfo_paraViewModel();
                viewModel.setFromSerial(item);
                this.excel_underlyingInfo_paraViewModel_.Add(viewModel);
            }

            FpmlSerializedCSharp.Excel_correlationInfo_para serial_excel_correlationInfo_para = serial_Excel_underlyingCalcInfo_para.Excel_correlationInfo_para_;
            //string excel_correlationInfo_paratype = serial_excel_correlationInfo_para.Excel_type_.ValueStr;
            this.excel_correlationInfo_paraViewModel_ = new Excel_correlationInfo_paraViewModel();//.CreateExcel_correlationInfo_para(excel_correlationInfo_paratype);
            this.excel_correlationInfo_paraViewModel_.setFromSerial(serial_excel_correlationInfo_para);
        }
        public Excel_underlyingCalcInfo_paraViewModel underInfo_para(Excel_underlyingCalcInfoViewModel underInfo)
        {
            Excel_underlyingCalcInfo_paraViewModel e_uc_pvm = new Excel_underlyingCalcInfo_paraViewModel();

            Excel_underlyingInfo_paraViewModel e_u_pvm = new Excel_underlyingInfo_paraViewModel();
            e_u_pvm.Excel_underlyingModel_paraViewModel_ = new Excel_geometricBMViewModel();

            e_u_pvm.CurrentValue_ = "100";

            Excel_geometricBMViewModel e_gbmvm = new Excel_geometricBMViewModel();

            e_gbmvm.Dividend_ = "0.012";
            e_gbmvm.Drift_ = "0.03";
            e_gbmvm.Volatility_ = "0.03";

            e_u_pvm.Excel_underlyingModel_paraViewModel_ = e_gbmvm;

            e_uc_pvm.Excel_underlyingInfo_paraViewModel_.Add(e_u_pvm);

            return e_uc_pvm;
        
        }
        public Excel_underlyingCalcInfo_paraViewModel underInfo_para(Excel_underlyingCalcInfoViewModel underInfo)
        {
            Excel_underlyingCalcInfo_paraViewModel e_uc_pvm = new Excel_underlyingCalcInfo_paraViewModel();

            Excel_underlyingInfo_paraViewModel e_u_pvm = new Excel_underlyingInfo_paraViewModel();

            e_u_pvm.Excel_underlyingModel_paraViewModel_ = new Excel_geometricBMViewModel();

            e_u_pvm.CurrentValue_ = "100";

            Excel_geometricBMViewModel e_gbmvm = new Excel_geometricBMViewModel();

            e_gbmvm.Dividend_   = "0.012";
            e_gbmvm.Drift_      = "0.03";
            e_gbmvm.Volatility_ = "0.03";

            e_u_pvm.Excel_underlyingModel_paraViewModel_ = e_gbmvm;

            e_uc_pvm.Excel_underlyingInfo_paraViewModel_.Add(e_u_pvm);

            return(e_uc_pvm);
        }
 private void UnderlyingParaGrid__SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     this.selectedViewModel_ = this.UnderlyingParaGrid_.SelectedItem as Excel_underlyingInfo_paraViewModel;
 }
        private void addUnderlying(string underCodes)
        {
            string[] underCodeList = underCodes.Split(',', '|');

            foreach (var item2 in underCodeList)
            {
                bool existFlag = false;

                // ir part A
                foreach (var item in this.swapInterfaceVM_.Excel_swapLegViewModel_[0].getExcel_underlyingCalcInfoViewModel().Excel_underlyingInfoViewModel_)
                {
                    if (item2.Trim().ToUpper() == item.KrCode_.ToUpper())
                    {
                        existFlag = true;
                    }
                }

                // hifive part B
                foreach (var item in this.swapInterfaceVM_.Excel_swapLegViewModel_[1].getExcel_underlyingCalcInfoViewModel().Excel_underlyingInfoViewModel_)
                {
                    if (item2.Trim().ToUpper() == item.KrCode_.ToUpper())
                    {
                        existFlag = true;
                    }
                }

                if (!existFlag)
                {
                    Excel_underlyingInfoViewModel e_uivm = Excel_loaderViewModel.loadUnderInfoWithoutBasePrice(item2);

                    this.InstVM_.Excel_interfaceViewModel_.Excel_underlyingCalcInfoViewModel_.
                        Excel_underlyingInfoViewModel_.Add(e_uivm);

                    Excel_standardSwapParaViewModel e_sspvm = this.InstVM_.Excel_parameterViewModel_ as Excel_standardSwapParaViewModel;

                    Excel_underlyingInfo_paraViewModel e_ui_pvm = new Excel_underlyingInfo_paraViewModel();

                    e_ui_pvm.buildParaSetting(e_uivm);

                    e_sspvm.Excel_underlyingCalcInfo_paraViewModel_.Excel_underlyingInfo_paraViewModel_.Add(e_ui_pvm);

                    e_sspvm.Excel_underlyingCalcInfo_paraViewModel_.Excel_correlationInfo_paraViewModel_.addDiagonal(e_ui_pvm);
                }

            }

            return;

        }
        public void buildParaSetting(ParameterSettingManager paraSettingManager)
        {
            this.excel_underlyingInfo_paraViewModel_.Clear();

            Excel_underlyingCalcInfoViewModel e_ucvm = paraSettingManager.Excel_InstrumentViewModel_.Excel_interfaceViewModel_.getExcel_underlyingCalcInfoViewModel();

            foreach (var item in e_ucvm.Excel_underlyingInfoViewModel_)
            {
                Excel_underlyingInfo_paraViewModel e_uparavm = new Excel_underlyingInfo_paraViewModel();

                e_uparavm.buildParaSetting(item,paraSettingManager);

                this.excel_underlyingInfo_paraViewModel_.Add(e_uparavm);

            }

            this.excel_correlationInfo_paraViewModel_.buildParaSetting(paraSettingManager);
        }
        public void setFromSerial(FpmlSerializedCSharp.ISerialized serial_Class)
        {
            FpmlSerializedCSharp.Excel_underlyingCalcInfo_para serial_Excel_underlyingCalcInfo_para = serial_Class as FpmlSerializedCSharp.Excel_underlyingCalcInfo_para;

            List<FpmlSerializedCSharp.Excel_underlyingInfo_para> serial_excel_underlyingInfo_para = serial_Excel_underlyingCalcInfo_para.Excel_underlyingInfo_para_;
            this.excel_underlyingInfo_paraViewModel_ = new ObservableCollection<Excel_underlyingInfo_paraViewModel>();
            foreach (var item in serial_excel_underlyingInfo_para)
            {
                string type = item.Excel_type_.ValueStr;
                Excel_underlyingInfo_paraViewModel viewModel = new Excel_underlyingInfo_paraViewModel();
                viewModel.setFromSerial(item);
                this.excel_underlyingInfo_paraViewModel_.Add(viewModel);
            }

            FpmlSerializedCSharp.Excel_correlationInfo_para serial_excel_correlationInfo_para = serial_Excel_underlyingCalcInfo_para.Excel_correlationInfo_para_;
            //string excel_correlationInfo_paratype = serial_excel_correlationInfo_para.Excel_type_.ValueStr;
            this.excel_correlationInfo_paraViewModel_ = new Excel_correlationInfo_paraViewModel();//.CreateExcel_correlationInfo_para(excel_correlationInfo_paratype);
            this.excel_correlationInfo_paraViewModel_.setFromSerial(serial_excel_correlationInfo_para);
        }
        public string load_instrument(string itemCode)
        {
            try
            {
                Excel_instrumentViewModel e_i_hvm = MasterInformationViewModel.loadInstrumentVM(itemCode);

                //this.InstVM_ = new Excel_instrument_hifiveViewModel();
                this.InstVM_ = e_i_hvm as Excel_instrument_structuredBondViewModel;

                if (this.InstVM_ == null)
                    throw new Exception("instrument is not structuredBond type");

                this.InstVM_.loadInterfaceVMFromXml(XMLFileLoader.LoadInstrument(itemCode));

                //
                Excel_standardParaViewModel e_spvm = this.InstVM_.Excel_parameterViewModel_ as Excel_standardParaViewModel;
                //

                foreach (var item in InstVM_.Excel_interfaceViewModel_.Excel_underlyingCalcInfoViewModel_.Excel_underlyingInfoViewModel_)
                {
                    Excel_underlyingInfo_paraViewModel e_u_pvm = new Excel_underlyingInfo_paraViewModel();

                    e_u_pvm.buildParaSetting(item);

                    e_spvm.Excel_underlyingCalcInfo_paraViewModel_.Excel_underlyingInfo_paraViewModel_.Add(e_u_pvm);
                    e_spvm.Excel_underlyingCalcInfo_paraViewModel_.Excel_correlationInfo_paraViewModel_.addDiagonal(e_u_pvm);

                }

                return "load complete";
            }
            catch (Exception e)
            {
                return "load err : " + e.Message;
            }
        }
        public void addDiagonal(Excel_underlyingInfo_paraViewModel e_ui_pvm)
        {

            string under = e_ui_pvm.KrCode_;

            this.underlyingList_.Add(under);

            this.dimension_ += 1;

            Excel_correlation_paraViewModel diagCorrVM = new Excel_correlation_paraViewModel();

            diagCorrVM.First_ = under;
            diagCorrVM.Second_ = under;
            diagCorrVM.Value_ = "1.0";

            this.excel_correlation_paraViewModel_.Add(diagCorrVM);
            
        }
Esempio n. 15
0
 private void UnderlyingParaGrid__SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     this.selectedViewModel_ = this.UnderlyingParaGrid_.SelectedItem as Excel_underlyingInfo_paraViewModel;
 }