private Excel_vanillaFloatingCouponScheduleViewModel excel_vanillaSimpleVMBuild(Excel_vanillaFloatingBond_subScheduleViewModel excel_subScheduleVM)
        {
            Excel_vanillaFloatingCouponScheduleViewModel e_vfcsvm = new Excel_vanillaFloatingCouponScheduleViewModel();

            e_vfcsvm.EventDate_ = excel_subScheduleVM.EventDate_;

            e_vfcsvm.CalculationStartDate_ = excel_subScheduleVM.CalculationStartDate_;
            e_vfcsvm.CalculationEndDate_   = excel_subScheduleVM.CalculationEndDate_;
            e_vfcsvm.PayoffDate_           = excel_subScheduleVM.PaymentDate_;
            e_vfcsvm.Gearing_ = excel_subScheduleVM.Gearing_;
            e_vfcsvm.Spread_  = excel_subScheduleVM.Spread_;

            e_vfcsvm.Excel_underlyingCalcInfoViewModel_ = this.excel_underlyingCalcInfoViewModel_;

            e_vfcsvm.Excel_underlyingCalcIDViewModel_ = new Excel_maximumUnderlyingCalcIDViewModel();

            return(e_vfcsvm);
        }
        public void setFromSerial(FpmlSerializedCSharp.ISerialized serial_Class)
        {
            FpmlSerializedCSharp.Excel_vanillaFloatingCouponScheduleList serial_Excel_vanillaFloatingCouponScheduleList = serial_Class as FpmlSerializedCSharp.Excel_vanillaFloatingCouponScheduleList;

            this.fixedRate_ = serial_Excel_vanillaFloatingCouponScheduleList.FixedRate_.ValueStr;

            this.dayCounter_ = serial_Excel_vanillaFloatingCouponScheduleList.DayCounter_.ValueStr;

            List <FpmlSerializedCSharp.Excel_vanillaFloatingCouponSchedule> serial_excel_vanillaFloatingCouponSchedule = serial_Excel_vanillaFloatingCouponScheduleList.Excel_vanillaFloatingCouponSchedule_;

            this.excel_vanillaFloatingCouponScheduleViewModel_ = new ObservableCollection <Excel_vanillaFloatingCouponScheduleViewModel>();
            foreach (var item in serial_excel_vanillaFloatingCouponSchedule)
            {
                string type = item.Excel_type_.ValueStr;
                Excel_vanillaFloatingCouponScheduleViewModel viewModel = Excel_vanillaFloatingCouponScheduleViewModel.CreateExcel_vanillaFloatingCouponSchedule(type);
                viewModel.setFromSerial(item);
                this.excel_vanillaFloatingCouponScheduleViewModel_.Add(viewModel);
            }
        }
Ejemplo n.º 3
0
        public void setFromSerial(FpmlSerializedCSharp.ISerialized serial_Class)
        {
            FpmlSerializedCSharp.Excel_vanillaFloatingCouponScheduleList serial_Excel_vanillaFloatingCouponScheduleList = serial_Class as FpmlSerializedCSharp.Excel_vanillaFloatingCouponScheduleList;

            //this.scheduleInitialDate_ = serial_Excel_vanillaFloatingCouponScheduleList.ScheduleInitialDate_.ValueStr;
            this.fixedRate_  = serial_Excel_vanillaFloatingCouponScheduleList.FixedRate_.ValueStr;
            this.dayCounter_ = serial_Excel_vanillaFloatingCouponScheduleList.DayCounter_.ValueStr;
            //this.maturityDate_ = serial_Excel_vanillaFloatingCouponScheduleList.MaturityDate_.ValueStr;

            List <FpmlSerializedCSharp.Excel_vanillaFloatingCouponSchedule> serial_excel_vanillaFloatingCouponSchedule = serial_Excel_vanillaFloatingCouponScheduleList.Excel_vanillaFloatingCouponSchedule_;

            this.excel_vanillaFloatingCouponScheduleViewModel_ = new ObservableCollection <Excel_vanillaFloatingCouponScheduleViewModel>();
            foreach (var item in serial_excel_vanillaFloatingCouponSchedule)
            {
                Excel_vanillaFloatingCouponScheduleViewModel viewModel = new Excel_vanillaFloatingCouponScheduleViewModel();
                viewModel.setFromSerial(item);
                this.excel_vanillaFloatingCouponScheduleViewModel_.Add(viewModel);
            }
        }
 public  void setFromSerial(FpmlSerializedCSharp.ISerialized serial_Class)
 {
     FpmlSerializedCSharp.Excel_vanillaFloatingCouponScheduleList serial_Excel_vanillaFloatingCouponScheduleList = serial_Class as FpmlSerializedCSharp.Excel_vanillaFloatingCouponScheduleList;
 
     //this.scheduleInitialDate_ = serial_Excel_vanillaFloatingCouponScheduleList.ScheduleInitialDate_.ValueStr;
     this.fixedRate_ = serial_Excel_vanillaFloatingCouponScheduleList.FixedRate_.ValueStr;
     this.dayCounter_ = serial_Excel_vanillaFloatingCouponScheduleList.DayCounter_.ValueStr;
     //this.maturityDate_ = serial_Excel_vanillaFloatingCouponScheduleList.MaturityDate_.ValueStr;
     
     List<FpmlSerializedCSharp.Excel_vanillaFloatingCouponSchedule> serial_excel_vanillaFloatingCouponSchedule = serial_Excel_vanillaFloatingCouponScheduleList.Excel_vanillaFloatingCouponSchedule_;
     this.excel_vanillaFloatingCouponScheduleViewModel_ = new ObservableCollection<Excel_vanillaFloatingCouponScheduleViewModel>();
     foreach (var item in serial_excel_vanillaFloatingCouponSchedule)
     {
         Excel_vanillaFloatingCouponScheduleViewModel viewModel = new Excel_vanillaFloatingCouponScheduleViewModel();
         viewModel.setFromSerial(item);
         this.excel_vanillaFloatingCouponScheduleViewModel_.Add(viewModel);
     }
     
 }
        public string addVanillaCoupon(DateTime calculationStartDate,
                                        DateTime calculationEndDate,
                                        DateTime payoffDate,
                                        double gearing,
                                        double spread,
                                        string underlyingCode)
        {
            try
            {
                #region CheckParameter

                if (calculationStartDate >= calculationEndDate)
                    throw new Exception("startDate must be earlier than endDate");

                // check underlying 
                if ( !this.hasUnderlyings(underlyingCode) )
                    throw new Exception(underlyingCode + " does not exist. add underlying first.");


                #endregion

                Excel_vanillaFloatingCouponScheduleViewModel e_vfcsvm = new Excel_vanillaFloatingCouponScheduleViewModel();

                // ---------------- underlying part

                //this.addUnderlying(underlyingCode);

                Excel_underlyingCalcInfoViewModel e_ucivm = this.InstVM_.Excel_interfaceViewModel_.Excel_underlyingCalcInfoViewModel_;

                e_vfcsvm.Excel_underlyingCalcInfoViewModel_ = e_ucivm;

                Excel_underlyingCalcIDViewModel e_mucidvm =
                    Excel_underlyingCalcIDViewModel.CreateExcel_underlyingCalcID("CHOICE");

                e_mucidvm.EventDate_ = payoffDate;

                e_mucidvm.setUnderlying(e_ucivm);
                e_mucidvm.selectUnderlyings(underlyingCode);

                e_vfcsvm.Excel_underlyingCalcIDViewModel_ = e_mucidvm;

                // ----------------- coupon part

                e_vfcsvm.EventDate_ = payoffDate;

                e_vfcsvm.CalculationStartDate_ = calculationStartDate;
                e_vfcsvm.CalculationEndDate_ = calculationEndDate;
                e_vfcsvm.PayoffDate_ = payoffDate;

                e_vfcsvm.Gearing_ = gearing.ToString();
                e_vfcsvm.Spread_ = spread.ToString();
                e_vfcsvm.OutGearing_ = "1.0";
                e_vfcsvm.OutSpread_ = "0.0";
                e_vfcsvm.Cap_ = "99.0";
                e_vfcsvm.Floor_ = "-99.0";

                Excel_structuredBondViewModel e_sbvm = this.InstVM_.Excel_interfaceViewModel_ as Excel_structuredBondViewModel;

                e_sbvm.Excel_couponScheduleListViewModel_.Excel_couponScheduleViewModel_.Add(e_vfcsvm);

                int schNum = e_sbvm.Excel_couponScheduleListViewModel_.Excel_couponScheduleViewModel_.Count - 1;

                //this.instVM_.Excel_interfaceViewModel_ = e_sbvm;

                List<string> member = vanillaFloatingCpnMember_;
                List<string> value = new List<string>() { "structuredBond", "vanillaCpn_sch", schNum.ToString(), 
                                                           StringConverter.xmlDateTimeToDateString(calculationStartDate), 
                                                           StringConverter.xmlDateTimeToDateString(calculationEndDate),
                                                           StringConverter.xmlDateTimeToDateString(payoffDate),
                                                           gearing.ToString(),
                                                           spread.ToString(),
                                                           underlyingCode };

                e_vfcsvm.VBA_description_ = this.vba_description(member, value);

                return "OK";
            }
            catch (Exception)
            {
                return "vanillaCpn Add Fail";
                throw;
            }
            
        }
        private Excel_vanillaFloatingCouponScheduleViewModel excel_vanillaSimpleVMBuild(Excel_vanillaFloatingBond_subScheduleViewModel excel_subScheduleVM)
        {
            Excel_vanillaFloatingCouponScheduleViewModel e_vfcsvm = new Excel_vanillaFloatingCouponScheduleViewModel();

            e_vfcsvm.EventDate_ = excel_subScheduleVM.EventDate_;

            e_vfcsvm.CalculationStartDate_ = excel_subScheduleVM.CalculationStartDate_;
            e_vfcsvm.CalculationEndDate_ = excel_subScheduleVM.CalculationEndDate_;
            e_vfcsvm.PayoffDate_ = excel_subScheduleVM.PaymentDate_;
            e_vfcsvm.Gearing_ = excel_subScheduleVM.Gearing_;
            e_vfcsvm.Spread_ = excel_subScheduleVM.Spread_;
            
            e_vfcsvm.Excel_underlyingCalcInfoViewModel_ = this.excel_underlyingCalcInfoViewModel_;

            e_vfcsvm.Excel_underlyingCalcIDViewModel_ = new Excel_maximumUnderlyingCalcIDViewModel();

            return e_vfcsvm;
        }