예제 #1
0
        public void enqueue_intrument(string itemCode)
        {
            // itemCode 를 master에서 찾아서 만들어서 넣음

            try
            {
                Excel_instrumentViewModel e_ivm = MasterInformationViewModel.loadInstrumentVM(itemCode);

                // inst xml
                e_ivm.loadInterfaceVMFromXml(XMLFileLoader.LoadInstrument(itemCode));

                // para xml
                e_ivm.loadParameterFromXml(XMLFileLoader.LoadParameter(itemCode, this.calculationDate_));

                BatchItemViewModel bvm = new BatchItemViewModel(e_ivm);

                this.BatchItemViewModelQueueList_.Add(bvm);
            }
            catch (Exception e)
            {
                throw e;
            }

            //
        }
예제 #2
0
        public virtual void calculate(string instCode, DateTime refDate)
        {
            this.inst_xmlDoc_ = XMLFileLoader.LoadInstrument(instCode);
            this.para_xmlDoc_ = XMLFileLoader.LoadParameter(instCode, refDate);

            this.calculateSavedXml(refDate);
        }
예제 #3
0
 private void loadParameter()
 {
     foreach (var item in this.BatchItemViewModelQueueList_)
     {
         item.Excel_instrumentViewModel_.loadParameterFromXml(
             XMLFileLoader.LoadParameter(item.ItemCode_, this.calculationDate_));
     }
 }
        public void booking(Excel_instrumentViewModel e_inst_sbvm)
        {
            e_inst_sbvm.bookingInstrument();
            MasterInformationViewModel.WholeMasterPosition_.Add(e_inst_sbvm);

            this.AddInstrument(e_inst_sbvm);

            XMLFileLoader.SaveInstrument(e_inst_sbvm);
        }
        public void parameterBuild(DateTime refDate)
        {
            try
            {
                this.excel_instrumentViewModel_.loadBatchDetailContext();

                this.excel_instrumentViewModel_.buildParameterFromInstrument(refDate);

                XMLFileLoader.SaveParameter(this.excel_instrumentViewModel_.Excel_parameterViewModel_);

                this.ParameterStatus_ = "OK";
            }
            catch (Exception e)
            {
                this.ParameterStatus_ = "error : " + e.Message;
                //throw;
            }
        }
예제 #6
0
        public void loadParameterFromXml(XmlDocument xmlDoc = null)
        {
            //this.excel_parameterViewModel_.loadParameterFromXml();

            //XmlDocument xmlDoc = XMLFileLoader.LoadParameter(this.masterInformationViewModel_.Item_code_,
            //                                                 this.excel_parameterViewModel_.ReferenceDate_);

            if (xmlDoc == null)
            {
                this.para_xmlDoc_ = XMLFileLoader.LoadParameter(this.masterInformationViewModel_.Item_code_,
                                                                this.excel_parameterViewModel_.ReferenceDate_);
            }
            else
            {
                this.para_xmlDoc_ = xmlDoc;
            }

            try
            {
                if (this.para_xmlDoc_ != null)
                {
                    XmlNode paraNode = this.para_xmlDoc_.SelectSingleNode("pricing/excel_parameter");

                    FpmlSerializedCSharp.Excel_parameter serial_excel_parameter
                        = new FpmlSerializedCSharp.Excel_parameter(paraNode);

                    this.excel_parameterViewModel_.setFromSerial(serial_excel_parameter);

                    XmlNode resultNode = this.para_xmlDoc_.SelectSingleNode("pricing/pricingResult");

                    if (resultNode != null)
                    {
                        FpmlSerializedCSharp.PricingResult serial_pricingResult
                            = new FpmlSerializedCSharp.PricingResult(resultNode);

                        this.excel_parameterViewModel_.Excel_resultViewModel_.setFromSerial(serial_pricingResult);
                    }
                }
            }
            catch (Exception e)
            {
                OutputLogViewModel.addResult("parameter load error : " + e.Message);
            }
        }
        //private void fixedBondButton_Click(object sender, RoutedEventArgs e)
        //{
        //    Excel_instrumentViewModel e_instVM = new Excel_instrument_fixedBondViewModel(true);
        //    this.menuBooking(e_instVM);

        //}

        //private void elsStepDownKIButton_Click(object sender, RoutedEventArgs e)
        //{
        //    Excel_instrumentViewModel e_instVM = new Excel_instrument_hifiveViewModel(true);

        //    this.menuBooking(e_instVM);
        //}

        //private void elsStepDownKICustomButton_Click(object sender, RoutedEventArgs e)
        //{
        //    Excel_instrumentViewModel e_instVM = new Excel_instrument_stepDownKICustomViewModel(true);

        //    this.menuBooking(e_instVM);
        //}

        //private void compositeOptionButton_Click(object sender, RoutedEventArgs e)
        //{
        //    Excel_instrumentViewModel e_instVM = new Excel_instrument_compositeOptionViewModel(true);

        //    this.menuBooking(e_instVM);
        //}

        //private void makeInstButton_Click(object sender, RoutedEventArgs e)
        //{
        //    Excel_instrumentViewModel e_instVM = new Excel_instrument_generalViewModel(true);

        //    this.menuBooking(e_instVM);

        //}


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

        //}

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

        //}

        private void menuBooking(Excel_instrumentViewModel e_instVM)
        {
            Window w = new Window();

            w.Width   = 400;
            w.Height  = 400;
            w.Content = e_instVM.view(true);

            e_instVM.linkEventPass();

            w.Visibility = 0;

            // booking button 눌리면
            if (w.ShowDialog() == true)
            {
                // master db에 박고
                // file 저장하고
                e_instVM.bookingInstrument(); // db에 박음.

                XMLFileLoader.SaveInstrument(e_instVM);

                MasterInformationViewModel.WholeMasterPosition_.Add(e_instVM);
                // 우선은 미분류로 보냄
                // favoriteViewModel에 instrument List 에 더하고
                this.rootFavoriteViewModel_.UnClassifiedFavoriteViewModel_.AddInstrument(e_instVM);

                ////이놈은 상품 xml 저장이 아니고 favor xml 저장
                this.rootFavoriteViewModel_.saveXml();

                //unclassified_fvm.InstrumentList_.Add(e_instVM);

                // menu booking의 경우 refDate기준으로 임시 파라메터를 만들어줌.

                e_instVM.buildParameterFromInstrument(ProgramVariable.ReferenceDate_);

                XMLFileLoader.SaveParameter(e_instVM.Excel_parameterViewModel_);
                XMLFileLoader.SaveHistoryData(e_instVM);
            }
            else
            {
            }
        }
        public void checkParameterBuild(DateTime refDate)
        {
            try
            {
                bool tf = XMLFileLoader.isFileExist(this.excel_instrumentViewModel_.Item_code_, refDate);

                if (tf)
                {
                    this.ParameterStatus_ = "OK";
                }
                else
                {
                    this.ParameterStatus_ = "Fail";
                }
            }
            catch (Exception)
            {
                this.ParameterStatus_ = "Fail";
            }
        }
예제 #9
0
        public override void bookingFromTradeString(TradeString tradeString)
        {
            this.excel_interfaceViewModel_.buildFromTradeString(tradeString);

            // --------------------------------------------------------------
            this.masterInformationViewModel_.Item_name_       = tradeString.Name_;
            this.masterInformationViewModel_.Trade_date_      = this.excel_interfaceViewModel_.Excel_issueInfoViewModel_.EffectiveDate_;
            this.masterInformationViewModel_.Maturity_date_   = this.excel_interfaceViewModel_.Excel_issueInfoViewModel_.MaturityDate_;
            this.masterInformationViewModel_.Export_itemcode_ = tradeString.ExportCode_;

            // --------------------------------------------------------------
            this.excel_interfaceViewModel_.ItemCode_ = this.masterInformationViewModel_.Item_code_;
            // --------------------------------------------------------------
            //this.bookingFromTradeString(tradeString);

            this.bookingInstrument(); // db에 박음.

            XMLFileLoader.SaveInstrument(this);

            //이건 생략
            //MasterInformationViewModel.WholeMasterPosition_.Add(e_instVM);
        }
        public void generateParaXml(DateTime refDate)
        {
            // book 상의 inst를 로드함.
            //{
            //    // 로드 전체 code list를 불름

            //    RootBookViewModel rbvm = new RootBookViewModel();

            //    RootBookViewModel.setRootBookReferenceDate(refDate);

            //    rbvm.loadPosition();

            //    //List<string> codeList = rbvm.getWholeItemCode();
            //    List<Excel_instrumentViewModel> e_instVMList =
            //        rbvm.getWholeInstrument();
            //}

            foreach (var item in MasterInformationViewModel.WholeMasterPosition_)
            {
                //Excel_instrumentViewModel instrument =
                //    CodeClassificationGenerator.CreateInstrument(item);

                //instrument.Item_code_ = item;

                //item.loadInterfaceVMFromXml();
                item.loadBatchDetailContext();

                item.buildParameterFromInstrument(refDate);
                //item.loadMarketData(refDate);

                //string result = item.generateParameterXml();

                XMLFileLoader.SaveParameter(item.Excel_parameterViewModel_);

            }
        }
예제 #11
0
 public void saveXml()
 {
     XMLFileLoader.SaveParameter(this.itemCode_, this.paraXml(), this.referenceDate_);
 }
예제 #12
0
        private void Booking_Button_Click(object sender, RoutedEventArgs e)
        {
            OutputLogViewModel.addResult("not implemented! now test");

            XMLFileLoader.SaveInstrument(this.viewModel_);
        }
예제 #13
0
        public void loadInterfaceVMFromXml(XmlDocument xmlDoc = null)
        {
            //this.excel_interfaceViewModel_.loadInterfaceFromXml();

            try
            {
            }
            catch (Exception)
            {
                OutputLogViewModel.addResult(masterInformationViewModel_.Item_name_ + " : Xml invalid!");
            }

            //XmlDocument xmlDoc = XMLFileLoader.LoadInstrument(this.masterInformationViewModel_.Item_code_);
            if (xmlDoc == null)
            {
                this.inst_xmlDoc_ = XMLFileLoader.LoadInstrument(this.masterInformationViewModel_.Item_code_);
            }
            else
            {
                this.inst_xmlDoc_ = xmlDoc;
            }

            try
            {
                FpmlSerializedCSharp.Instrument_Menual xml_instrument
                    = new FpmlSerializedCSharp.Instrument_Menual(inst_xmlDoc_.SelectSingleNode("instrument"));

                //XmlNode interfaceNode = inst_xmlDoc_.SelectSingleNode("instrument/excel_interface");

                //FpmlSerializedCSharp.Excel_interface excel_interface
                //    = new FpmlSerializedCSharp.Excel_interface(interfaceNode);

                if (xml_instrument.Excel_interface_ != null)
                {
                    FpmlSerializedCSharp.Excel_interface excel_interface = xml_instrument.Excel_interface_;
                    this.excel_interfaceViewModel_.setFromSerial(excel_interface);
                }
                else if (xml_instrument.Excel_swapInterface_ != null)
                {
                    FpmlSerializedCSharp.Excel_swapInterface excel_swapInterface = xml_instrument.Excel_swapInterface_;
                    this.excel_interfaceViewModel_.setFromSerial(excel_swapInterface);
                }
                else
                {
                    throw new Exception("interfaceXml is null");
                }

                // 여기서 로드해야할거 같은데...
                // settle event , termination event
                // settle 된거 라던지...
                // 임의로 call 할거 라던지..
                //

                //Event

                //FpmlSerializedCSharp.Excel_interface excel_interface
                //= new FpmlSerializedCSharp.Excel_interface(interfaceNode);

                //this.excel_interfaceViewModel_.setFromSerial(excel_interface);
            }
            catch (Exception e)
            {
                OutputLogViewModel.addResult("interface load error : " + e.Message);

                throw new Exception("interface load error" + " : " + e.Message);
                //OutputLogViewModel.addResult(masterInformationViewModel_.Item_name_ + " : Xml invalid!");
            }

            //this.setFromXml(instNode);
        }