Exemplo n.º 1
0
        // empty_calculation result를 만듬.기존거 있으면 지움. 초기화임.
        private void build_calculation()
        {
            // 당일자 ( result 는 만들고 cashflow도 만들어야대나...? )
            clsHITM_FP_GREEKRESULT_TB clstb_result = new clsHITM_FP_GREEKRESULT_TB();

            // 기존거 있으면 지움. 초기화임.
            clstb_result.CALC_DT = this.ReferenceDate_.ToString("yyyyMMdd");
            clstb_result.DeleteDate();

            clsMAST_FP_INSTRUMENT_TB clstb_mast = new clsMAST_FP_INSTRUMENT_TB();

            DataTable dt = clstb_mast.Select();

            List<Financial_instrument> fi_list = new List<Financial_instrument>();

            // master 의 list 내에서 position을 만들음.
            foreach (DataRow dr in dt.Select())
            {
                clsMAST_FP_INSTRUMENT_TB tb = clsMAST_FP_INSTRUMENT_TB.Create(dr);
                Financial_instrument fi = Financial_instrument.CreateInstrument(tb);
                fi_list.Add(fi);
            }

            foreach (Financial_instrument fi in fi_list)
            {
                fi.build_emptyResult(this.ReferenceDate_);
            }

        }
Exemplo n.º 2
0
        public void batch_calculate()
        { 
            //
            clsHDAT_BATCHJOB_RESULT_TB clstb = new clsHDAT_BATCHJOB_RESULT_TB();

            clstb.CALC_DT = this.ReferenceDate_.ToString("yyyyMMdd");
            clstb.START_TIME = DateTime.Now.ToString("HHmmdd");
            clstb.STATUS = (int)clsHDAT_BATCHJOB_RESULT_TB.STATUS_Type.CALCULATING;

            clstb.BATCH_JOB_ID = (int)clsHDAT_BATCHJOB_RESULT_TB.BATCH_JOB_ID_Type.FP_CACULATION;

            clstb.Update();

            // load 함 ------------------------------------------------------------------
            clsMAST_FP_INSTRUMENT_TB clstb_mast = new clsMAST_FP_INSTRUMENT_TB();

            DataTable dt = clstb_mast.Select();

            List<Financial_instrument> fi_list = new List<Financial_instrument>();

            foreach (DataRow dr in dt.Select())
            {
                clsMAST_FP_INSTRUMENT_TB tb = clsMAST_FP_INSTRUMENT_TB.Create(dr);

                Financial_instrument fi = Financial_instrument.CreateInstrument(tb);

                fi_list.Add(fi);
            }

            // ------------------------------------------------------------------

            try
            {
                foreach (Financial_instrument roop_fi in fi_list)
                {
                    roop_fi.calculate(this.ReferenceDate_);
                }
            }
            catch (Exception e)
            {
                this.LogManager_.addLog(e.Message);
            }

            // ------------------------------------------------------------------

            clstb.END_TIME = DateTime.Now.ToString("HHmmdd");
            clstb.STATUS = (int)clsHDAT_BATCHJOB_RESULT_TB.STATUS_Type.CALCULATED;

            clstb.Update();


        }
Exemplo n.º 3
0
        public void fpMasterResultLoad()
        {
            this.LoadedFPMasterResultVMList_.Clear();

            clsMAST_FP_INSTRUMENT_TB clstb = new clsMAST_FP_INSTRUMENT_TB();

            //clstb. = this.ReferenceDate_.ToString("yyyyMMdd");

            DataTable dt = clstb.Select();

            foreach (DataRow dr in dt.Select())
            {
                FP_MasterResultDataViewModel vm = new FP_MasterResultDataViewModel();
                
                vm.MastDAO_ = clsMAST_FP_INSTRUMENT_TB.Create(dr);
                vm.load_resultList(this.ReferenceDate_);

                this.LoadedFPMasterResultVMList_.Add(vm);
            }
        }
Exemplo n.º 4
0
        // 기존거 있으면 지움. 초기화임.
        public void build_position()
        {
            // 전일자 position date ?
            CalendarManager calendarM = new CalendarManager(this.ReferenceDate_, CalendarManager.CountryType.SOUTH_KOREA);
            DateTime preDate = calendarM.preBusinessDay(this.ReferenceDate_);

            clsHITM_FP_POSITION_TB clstb_position = new clsHITM_FP_POSITION_TB();
            clstb_position.POSITION_DT = this.ReferenceDate_.ToString("yyyyMMdd");
            clstb_position.DeleteDate();

            this.build_cashMaster();
            // ------------------------------------------------------------------------

            clsMAST_FP_INSTRUMENT_TB clstb_mast = new clsMAST_FP_INSTRUMENT_TB();

            DataTable dt = clstb_mast.Select();

            List<Financial_instrument> fi_list = new List<Financial_instrument>();

            // master 의 list 내에서 position을 만들음. // bookdate ? 감안해서 만듬?
            foreach (DataRow dr in dt.Select())
            {
                clsMAST_FP_INSTRUMENT_TB tb = clsMAST_FP_INSTRUMENT_TB.Create(dr);
                Financial_instrument fi = Financial_instrument.CreateInstrument(tb);
                fi_list.Add(fi);
            }

            foreach (Financial_instrument fi in fi_list)
            {
                // trading 할때에 같은 날짜는 나중에 더해서 만들어짐
                if (ConvertingTool.ToDateTime(fi.baseDAO_.BOOKED_DT).Date < this.ReferenceDate_.Date)
                { 
                    fi.build_position(preDate, this.ReferenceDate_);
                }
                
            }


        }
Exemplo n.º 5
0
        public void totalFPMasterLoad()
        {
            this.LoadedFPMasterDAOList_.Clear();

            // sub book 에 대한 검사.

            clsMAST_FP_INSTRUMENT_TB clstb = new clsMAST_FP_INSTRUMENT_TB();

            //clstb.BOOK_CD = book_cd;

            DataTable dt = clstb.Select();

            foreach (DataRow dr in dt.Select())
            {
                this.LoadedFPMasterDAOList_.Add(clsMAST_FP_INSTRUMENT_TB.Create(dr));
            }
        }
Exemplo n.º 6
0
        private static string nextMonthOrder(string typeStr, string yearStr, string monthStr)
        {
            clsMAST_FP_INSTRUMENT_TB clstb = new clsMAST_FP_INSTRUMENT_TB();

            List<string> idList = new List<string>();

            foreach (DataRow dr in clstb.Select().Select())
            {
                idList.Add(Convert.ToString(dr[0]));
            }

            //string k1 = idList[0].Substring(2, 1);
            //string k2 = idList[0].Substring(4, 1);
            //string k3 = idList[0].Substring(5, 1);

            List<int> order = (from inst_id in idList
                                where inst_id.Substring(2, 1) == typeStr &&
                                        inst_id.Substring(4, 1) == yearStr &&
                                        inst_id.Substring(5, 1) == monthStr
                                select IDGenerator.getIndex(inst_id.Substring(6, 3))).ToList<int>();

            int max = (order.Count == 0) ? -1 : order.Max();

            return IDGenerator.getLetter(max + 1, 3);
        }
Exemplo n.º 7
0
        private static string nextCurrencyOrder(string currency)
        {
            clsMAST_FP_INSTRUMENT_TB clstb = new clsMAST_FP_INSTRUMENT_TB();

            List<string> idList = new List<string>();

            foreach (DataRow dr in clstb.Select().Select())
            {
                idList.Add(Convert.ToString(dr[0]));
            }

            List<int> order = (from inst_id in idList
                               where inst_id.Substring(2, 3) == currency 
                               select IDGenerator.getIndex(inst_id.Substring(5, 4))).ToList<int>();

            int max = (order.Count == 0) ? -1 : order.Max();

            return IDGenerator.getLetter(max + 1, 4);


        }
Exemplo n.º 8
0
        private void build_cashMaster()
        { 
            #region Build Base Cash Master
            
            // cash를 만듬 -----------------------------------------------------------
            clsMAST_BOOKINFO_TB clstb_bookinfo = new clsMAST_BOOKINFO_TB();
            // krw 없는 booklist를 에다가 krw를 넣음

            DataTable noKRWCash_dt = clstb_bookinfo.SelectBookNoKRWCash();

            foreach (DataRow dr in noKRWCash_dt.Select() )
            {
                CurrencyCash cash_fi = 
                    CurrencyCash.CurrencyCashBooking("KRW",clsMAST_BOOKINFO_TB.Create(dr).BOOK_CD,this.ReferenceDate_);

                //cash_fi.build_cashPosition(this.ReferenceDate_);
            }

            DataTable totalBook_dt = clstb_bookinfo.Select();

            // 각각의 북마다 krw를 제외한 Currency 를 뜸
            clsHITM_CASH_INSTOCK_TB clstb_cash = new clsHITM_CASH_INSTOCK_TB();
            clsMAST_FP_INSTRUMENT_TB clstb_master = new clsMAST_FP_INSTRUMENT_TB();

            foreach (DataRow dr in totalBook_dt.Select())
            {
                string book_cd = clsMAST_BOOKINFO_TB.Create(dr).BOOK_CD;

                // book별 cash list
                foreach ( DataRow dr2 in clstb_cash.SelectCashesInEachBook(book_cd).Select() )
                {
                    string currency = clsHITM_CASH_INSTOCK_TB.Create(dr2).CURR;

                    if (clstb_master.SelectHasCurrency(currency, book_cd).Rows.Count == 0)
                    {
                        if (currency != "KRW")
                        { 
                            CurrencyCash cash_fi = 
                                CurrencyCash.CurrencyCashBooking(currency, clsMAST_BOOKINFO_TB.Create(dr).BOOK_CD, this.ReferenceDate_);
                        } 

                        //cash_fi.build_cashPosition(this.ReferenceDate_);

                    }

                }
                
            }

            #endregion

            // if 오늘 부킹댄거면 position , emptyGreekResult 만듬.
            clstb_master.FP_MASTER_TYP = (int)clsMAST_FP_INSTRUMENT_TB.FP_MASTER_TYP_Type.Money_Cash;
            clstb_master.BOOKED_DT = this.ReferenceDate_.ToString("yyyyMMdd");

            DataTable cash_dt = clstb_master.Select();

            foreach (DataRow dr in cash_dt.Select())
            {
                clsMAST_FP_INSTRUMENT_TB tb = clsMAST_FP_INSTRUMENT_TB.Create(dr);
                CurrencyCash cash_fi = (CurrencyCash)Financial_instrument.CreateInstrument(tb);
                cash_fi.build_cashPosition(this.ReferenceDate_);
                //cash_fi.build_emptyResult(this.ReferenceDate_);
            }

        }