public void addInstrument(TradeString tradeString)
        {
            Excel_instrument_hifiveViewModel e_inst_hifive_VM = new Excel_instrument_hifiveViewModel(true);

            e_inst_hifive_VM.bookingFromTradeString(tradeString);

        }
        private void instrumentBtn_Click(object sender, RoutedEventArgs e)
        {
            Excel_Interface.Excel_instrumentViewModel e_instVM = new Excel_instrument_hifiveViewModel();

            Window w = new Window();
            w.Width = 400;
            w.Height = 300;
            //w.Content = e_instVM.View_;
            w.Content = e_instVM.view(true);
            w.Visibility = 0;

            //e_hvm.buildHifive();
        }
Exemple #3
0
        public static Excel_instrumentViewModel CreateInstrument(string itemCode)
        {
            string[] sp = itemCode.Split('_');

            string typeNum = sp[1];

            if (typeNum == "700")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_hifiveViewModel();
                return(e_ivm);
            }
            else if (typeNum == "333")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_fixedBondViewModel();
                return(e_ivm);
            }
            else if (typeNum == "340")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_structuredBondViewModel();
                return(e_ivm);
            }
            else if (typeNum == "444")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_compositeOptionViewModel();
                return(e_ivm);
            }
            else if (typeNum == "450")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_multiAssetCompositeOptionViewModel();
                return(e_ivm);
            }
            else if (typeNum == "600")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_structuredSwapViewModel();
                return(e_ivm);
            }
            else if (typeNum == "700")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_hifiveViewModel();
                return(e_ivm);
            }

            else
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_generalViewModel();
                return(e_ivm);
            }
        }
        //private void loadBookItemList()
        //{
        //    // selected book

        //    // load item in book

        //    BookViewModel bvm = new BookViewModel();

        //    //bvm.addTestInstrumentLoad();

        //    this.instrumentListListView_.ItemsSource = bvm.InstrumentList_;
        //}

        //private void TreeViewItem_Selected(object sender, RoutedEventArgs e)
        //{

        //}

        #region MenuEvent

        private void menuBookingItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem mi = e.Source as MenuItem;

            switch (mi.Name.ToUpper())
            {
            case "FIXEDBOND":
            {     //do something;
                Excel_instrumentViewModel e_instVM = new Excel_instrument_fixedBondViewModel(true);
                this.menuBooking(e_instVM);
                break;
            }

            case "IRS":
            {     //do something;
                Excel_instrumentViewModel e_instVM = new Excel_instrument_irsViewModel(true);
                this.menuBooking(e_instVM);
                break;
            }

            case "CRS":
            {     //do something;
                Excel_instrumentViewModel e_instVM = new Excel_instrument_crsViewModel(true);
                this.menuBooking(e_instVM);
                break;
            }

            case "CDS":
            {     //do something;
                Excel_instrumentViewModel e_instVM = new Excel_instrument_cdsViewModel(true);
                this.menuBooking(e_instVM);
                break;
            }

            case "TWO":
            {     //do something else
                Excel_instrumentViewModel e_instVM = new Excel_instrument_hifiveViewModel(true);
                this.menuBooking(e_instVM);
                break;
            }

            case "HIFIVE":
            {     //something else again
                Excel_instrumentViewModel e_instVM = new Excel_instrument_hifiveViewModel(true);

                this.menuBooking(e_instVM);
                break;
            }

            case "STEPDOWN2":
            {     //something else again
                Excel_instrumentViewModel e_instVM = new Excel_instrument_stepDownKICustomViewModel(true);

                this.menuBooking(e_instVM);
                break;
            }

            case "COMPOSITEOPTION":
            {     //something else again
                Excel_instrumentViewModel e_instVM = new Excel_instrument_compositeOptionViewModel(true);

                this.menuBooking(e_instVM);
                break;
            }

            case "MULTIASSETCOMPOSITEOPTION":
            {     //something else again
                Excel_instrumentViewModel e_instVM = new Excel_instrument_multiAssetCompositeOptionViewModel(true);

                this.menuBooking(e_instVM);
                break;
            }

            case "GENERAL":
            {     //something else again
                Excel_instrumentViewModel e_instVM = new Excel_instrument_generalViewModel(true);

                this.menuBooking(e_instVM);
                break;
            }

            case "VANILLAFLOATINGBOND":
            {     //something else again
                Excel_instrumentViewModel e_instVM = new Excel_instrument_vanillaFloatingBondViewModel(true);

                this.menuBooking(e_instVM);
                break;
            }

            case "FXFORWARD":
            {     //something else again
                Excel_instrumentViewModel e_instVM = new Excel_instrument_fxForwardViewModel(true);

                this.menuBooking(e_instVM);
                break;
            }

            case "FXSWAP":
            {     //something else again
                Excel_instrumentViewModel e_instVM = new Excel_instrument_fxSwapViewModel(true);

                this.menuBooking(e_instVM);
                break;
            }

            case "FXEXCHANGE":
            {     //something else again
                Excel_instrumentViewModel e_instVM = new Excel_instrument_fxSpotViewModel(true);

                this.menuBooking(e_instVM);
                break;
            }
            }
        }
Exemple #5
0
        public void addInstrument(TradeString tradeString)
        {
            Excel_instrument_hifiveViewModel e_inst_hifive_VM = new Excel_instrument_hifiveViewModel(true);

            e_inst_hifive_VM.bookingFromTradeString(tradeString);
        }
 private static void testHifiveCalculation()
 {
     Excel_instrument_hifiveViewModel inst = new Excel_instrument_hifiveViewModel();
     DateTime refDate = new DateTime(2014,12,26);
     inst.calculate("testInst_1", refDate);
 }
        //private DateTime referenceDate_;

        public Instrument_hifive()
        {
            this.InstVM_ = new Excel_instrument_hifiveViewModel(true);
            this.ErrLog_ = new ErrLog();
        }
        public void 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_hifiveViewModel;

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

                this.InstVM_.loadInterfaceVMFromXml(XMLFileLoader.LoadInstrument(itemCode));
                
                ////
                //Excel_standardHifiveParaViewModel e_sphvm = this.InstVM_.Excel_parameterViewModel_ as Excel_standardHifiveParaViewModel;
                ////

                //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_sphvm.Excel_underlyingCalcInfo_paraViewModel_.Excel_underlyingInfo_paraViewModel_.Add(e_u_pvm);
                //    e_sphvm.Excel_underlyingCalcInfo_paraViewModel_.Excel_correlationInfo_paraViewModel_.addDiagonal(e_u_pvm);

                //}

                this.ErrLog_.add("load complete");
            }
            catch (Exception e)
            {
                this.ErrLog_.add("load err : " + e.Message);
            }
        }
        //private void loadBookItemList()
        //{ 
        //    // selected book

        //    // load item in book

        //    BookViewModel bvm = new BookViewModel();

        //    //bvm.addTestInstrumentLoad();

        //    this.instrumentListListView_.ItemsSource = bvm.InstrumentList_;
        //}

        //private void TreeViewItem_Selected(object sender, RoutedEventArgs e)
        //{

        //}

        #region MenuEvent

        private void menuBookingItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem mi = e.Source as MenuItem;

            switch (mi.Name.ToUpper())
            {
                case "FIXEDBOND":
                { //do something;
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_fixedBondViewModel(true);
                    this.menuBooking(e_instVM);
                    break;
                }

                case "IRS":
                { //do something;
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_irsViewModel(true);
                    this.menuBooking(e_instVM);
                    break;
                }

                case "CRS":
                { //do something;
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_crsViewModel(true);
                    this.menuBooking(e_instVM);
                    break;
                }

                case "CDS":
                { //do something;
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_cdsViewModel(true);
                    this.menuBooking(e_instVM);
                    break;
                }

                case "TWO":
                { //do something else
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_hifiveViewModel(true);
                    this.menuBooking(e_instVM);
                    break;
                }

                case "HIFIVE":
                { //something else again
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_hifiveViewModel(true);

                    this.menuBooking(e_instVM);
                    break;
                }

                case "STEPDOWN2":
                { //something else again
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_stepDownKICustomViewModel(true);

                    this.menuBooking(e_instVM);
                    break;
                }

                case "COMPOSITEOPTION":
                { //something else again
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_compositeOptionViewModel(true);

                    this.menuBooking(e_instVM);
                    break;
                }
                case "MULTIASSETCOMPOSITEOPTION":
                { //something else again
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_multiAssetCompositeOptionViewModel(true);

                    this.menuBooking(e_instVM);
                    break;
                }
                case "GENERAL":
                { //something else again
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_generalViewModel(true);

                    this.menuBooking(e_instVM);
                    break;
                }
                case "VANILLAFLOATINGBOND":
                { //something else again
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_vanillaFloatingBondViewModel(true);

                    this.menuBooking(e_instVM);
                    break;
                }
                case "FXFORWARD":
                { //something else again
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_fxForwardViewModel(true);

                    this.menuBooking(e_instVM);
                    break;
                }
                case "FXSWAP":
                { //something else again
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_fxSwapViewModel(true);

                    this.menuBooking(e_instVM);
                    break;
                }
                case "FXEXCHANGE":
                { //something else again
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_fxSpotViewModel(true);

                    this.menuBooking(e_instVM);
                    break;
                }

            }

            
        }
        public static Excel_instrumentViewModel CreateInstrument(string itemCode)
        {
            string[] sp = itemCode.Split('_');

            string typeNum = sp[1];

            if (typeNum == "700")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_hifiveViewModel();
                return e_ivm;
            }
            else if (typeNum == "333")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_fixedBondViewModel();
                return e_ivm;
            }
            else if (typeNum == "340")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_structuredBondViewModel();
                return e_ivm;
            }
            else if (typeNum == "444")  
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_compositeOptionViewModel();
                return e_ivm;
            }
            else if (typeNum == "450")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_multiAssetCompositeOptionViewModel();
                return e_ivm;
            
            }
            else if (typeNum == "600")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_structuredSwapViewModel();
                return e_ivm;
            }
            else if (typeNum == "700")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_hifiveViewModel();
                return e_ivm;
            }

            else
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_generalViewModel();
                return e_ivm;
            }

        }