public OTCApplicationBookViewModel()
        {
            RootBookViewModel.setRootBookReferenceDate(ProgramVariable.ReferenceDate_);

            BookFolderView bfv = new BookFolderView();

            bfv.ReferenceDate_ = ProgramVariable.ReferenceDate_;
            bfv.positionXmlReload();

            this.view_ = bfv;
        }
        public string load()
        {
            try
            {
                if (this.root_bvm == null)
                {
                    this.root_bvm = new RootBookViewModel();
                }

                return "loaded";
            }
            catch (Exception e)
            {
                return "load Fail : " + e.Message;
            }
            
        }
예제 #3
0
        public void loadDetailContext()
        {
            //try
            //{
            string type = this.masterInformationViewModel_.Booking_type_;

            this.excel_interfaceViewModel_           = Excel_InterfaceLoader.Load(type);
            this.excel_interfaceViewModel_.ItemCode_ = this.masterInformationViewModel_.Item_code_;
            //this.excel_interfaceViewModel_.TradeID_ = this.masterInformationViewModel_.Trade_id_;

            this.excel_parameterViewModel_           = Excel_parameterLoader.Load(type);
            this.excel_parameterViewModel_.ItemCode_ = this.masterInformationViewModel_.Item_code_;
            //this.excel_parameterViewModel_.TradeID_ = this.masterInformationViewModel_.Trade_id_;
            this.excel_parameterViewModel_.ReferenceDate_ = RootBookViewModel.rootBookReferenceDate();

            //링크
            //this.linkEventPass();

            this.excel_profitLossViewModel_                 = new Excel_profitLossViewModel();
            this.excel_profitLossViewModel_.ItemCode_       = this.masterInformationViewModel_.Item_code_;
            this.excel_profitLossViewModel_.TradeID_        = this.masterInformationViewModel_.Trade_id_;
            this.excel_profitLossViewModel_.ExportItemCode_ = this.masterInformationViewModel_.Export_itemcode_;

            this.loadInterfaceVMFromXml();
            this.loadParameterFromXml();

            // xml이 로드된 후에 setting 함.. xml로드할때 class가 생성되므로..
            this.excel_interfaceViewModel_.setUnderlying();

            //d 나중에 클릭 대면 로드함 왜냐면 DB접속이니까... 느릴까바.. 흐앙
            this.excel_profitLossViewModel_.ReferenceDate_ = RootBookViewModel.rootBookReferenceDate();
            this.excel_profitLossViewModel_.loadBookingInfo();
            //this.excel_profitLossViewModel_.loadNPV();
            //this.excel_profitLossViewModel_.loadTradeEvent();

            this.excel_eventManagerViewModel_           = new Excel_eventManagerViewModel();
            this.excel_eventManagerViewModel_.ItemCode_ = this.masterInformationViewModel_.Item_code_;
            this.excel_eventManagerViewModel_.dbLoad();
            //}
            //catch (Exception e)
            //{
            //    e.Source += "\n" + this.Item_code_;

            //    throw e;
            //}
        }
        private void rootBookViewModelReload()
        {
            this.RootBookViewModel_     = null;
            this.RootFavoriteViewModel_ = null;

            RootBookViewModel.setRootBookReferenceDate(this.referenceDate_);

            RootBookViewModel root_bvm = new RootBookViewModel();

            root_bvm.loadPosition();

            RootFavoriteViewModel root_fvm = new RootFavoriteViewModel();

            root_fvm.loadPosition();

            this.RootBookViewModel_ = root_bvm;
            this.RootBookViewModelChanged();

            this.RootFavoriteViewModel_ = root_fvm;
            this.RootFavoriteViewModelChanged();
        }
        private void rootBookViewModelReload()
        {
            this.RootBookViewModel_ = null;
            this.RootFavoriteViewModel_ = null;

            RootBookViewModel.setRootBookReferenceDate(this.referenceDate_);

            RootBookViewModel root_bvm = new RootBookViewModel();

            root_bvm.loadPosition();

            RootFavoriteViewModel root_fvm = new RootFavoriteViewModel();

            root_fvm.loadPosition();

            this.RootBookViewModel_ = root_bvm;
            this.RootBookViewModelChanged();

            this.RootFavoriteViewModel_ = root_fvm;
            this.RootFavoriteViewModelChanged();
        }
        public static void calculation()
        {
            DateTime refDate = DateTime.Now.AddDays(-1);

            RootBookViewModel root_bvm = new RootBookViewModel();

            RootBookViewModel.setRootBookReferenceDate(refDate);

            root_bvm.loadPosition();

            BookViewModel bvm = root_bvm.getBook("deltaHedgeBookCode");

            CalculationManagerViewModel cmvm = new CalculationManagerViewModel();

            cmvm.setBook(bvm);
            
            CalculationSetting setting = new CalculationSetting();
            setting.CalculateTypeEnum_ = CalculationSetting.CalculateTypeEnum.Parellel;

            cmvm.CalculationSetting_ = setting;

            cmvm.calculate(refDate);
        
        }
        public static void booking2()
        {
            DateTime refDate = DateTime.Now.AddDays(-1);

            RootBookViewModel root_bvm = new RootBookViewModel();

            RootBookViewModel.setRootBookReferenceDate(refDate);

            root_bvm.loadPosition();

            BookViewModel bvm = root_bvm.getBook("deltaHedgeBookCode");

            Make_instrument_structuredBond makeStructuredBond = new Make_instrument_structuredBond();

            DateTime eff = new DateTime(2014, 10, 11);
            DateTime mat = new DateTime(2015, 10, 11);
            double notional = 10000;
            string curr = "KRW";
            string daycount = "KOR";

            DateTime cpn1 = new DateTime(2015, 1, 11);
            DateTime cpn2 = new DateTime(2015, 4, 11);
            DateTime cpn3 = new DateTime(2015, 7, 11);
            DateTime cpn4 = new DateTime(2015, 10, 11);

            makeStructuredBond.makeIssueInfo(eff, mat, notional, curr, daycount);

            List<double> lowerRngList = new List<double>(){ 0.0 , 0.6 };
            List<string> referenceUnderCodeList = new List<string>() { "CD91AAA", "SX5E" };
            List<double> upperRngList = new List<double>(){ 0.06 , 10.0 };

            double fixedAccRate = 0.055;

            makeStructuredBond.addSingleConditionDualRangAccrualFixedCoupon(eff, cpn1, cpn1, lowerRngList, referenceUnderCodeList, upperRngList, fixedAccRate);
            makeStructuredBond.addSingleConditionDualRangAccrualFixedCoupon(cpn1, cpn2, cpn2, lowerRngList, referenceUnderCodeList, upperRngList, fixedAccRate);
            makeStructuredBond.addSingleConditionDualRangAccrualFixedCoupon(cpn2, cpn3, cpn3, lowerRngList, referenceUnderCodeList, upperRngList, fixedAccRate);
            makeStructuredBond.addSingleConditionDualRangAccrualFixedCoupon(cpn3, cpn4, cpn4, lowerRngList, referenceUnderCodeList, upperRngList, fixedAccRate);

            root_bvm.booking("deltaHedgeBookCode", makeStructuredBond.InstVM_);

            root_bvm.saveXml();

        }
        public static void booking()
        {
            DateTime refDate = DateTime.Now.AddDays(-1);

            RootBookViewModel root_bvm = new RootBookViewModel();

            RootBookViewModel.setRootBookReferenceDate(refDate);

            root_bvm.loadPosition();

            BookViewModel bvm = root_bvm.getBook("deltaHedgeBookCode");
            
            Make_instrument_structuredBond makeStructuredBond = new Make_instrument_structuredBond();
            
            DateTime eff = new DateTime(2014,10,11);
            DateTime mat = new DateTime(2015,10,11);
            double notional = 10000;
            string curr = "KRW";
            string daycount = "KOR";

            DateTime cpn1 = new DateTime(2015,1,11); double fixedRate = 0.03;
            DateTime cpn2 = new DateTime(2015,4,11);
            DateTime cpn3 = new DateTime(2015,7,11);
            DateTime cpn4 = new DateTime(2015,10,11);


            makeStructuredBond.makeIssueInfo(eff,mat,notional,curr,daycount);

            makeStructuredBond.addFixedCoupon(eff,cpn1,cpn1,fixedRate);
            makeStructuredBond.addFixedCoupon(cpn1,cpn2,cpn2,fixedRate);
            makeStructuredBond.addFixedCoupon(cpn2,cpn3,cpn3,fixedRate);
            makeStructuredBond.addFixedCoupon(cpn3,cpn4,cpn4,fixedRate);

            root_bvm.booking("deltaHedgeBookCode", makeStructuredBond.InstVM_);

            root_bvm.saveXml();

        }