Exemple #1
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_);
            }

        }
Exemple #2
0
        public void build_cashPosition(DateTime refDate)
        {
            clsHITM_CASH_INSTOCK_TB clstb_cash = new clsHITM_CASH_INSTOCK_TB();

            DataTable dt = clstb_cash.SelectCashesInEachBook(this.baseDAO_.BOOK_CD);

            clsHITM_FP_POSITION_TB clstb = new clsHITM_FP_POSITION_TB();

            foreach ( DataRow dr in dt.Select() )
	        {
                clsHITM_CASH_INSTOCK_TB tb_cash = clsHITM_CASH_INSTOCK_TB.Create(dr);

                clstb.POSITION_ID = IDGenerator.getNewPositionID(this.baseDAO_.INSTRUMENT_ID, refDate.ToString("yyyyMMdd"));
                clstb.FP_MASTER_TYP = this.baseDAO_.FP_MASTER_TYP;
                clstb.POSITION_DT = refDate.ToString("yyyyMMdd");
                clstb.BOOK_CD = this.baseDAO_.BOOK_CD;
                clstb.INSTRUMENT_ID = this.baseDAO_.INSTRUMENT_ID;
                clstb.INSTRUMENT_QNT = tb_cash.CASHFLOW;
                clstb.EVAL_CURR = tb_cash.CURR;
                clstb.CURR_RATE = 1.0;//tb_cash.CURR_RATE;
                clstb.NOTIONAL_AMT = tb_cash.CASHFLOW;
                clstb.ACCOUNT_AMT = tb_cash.CASHFLOW_DOMESTIC;
                clstb.ACCOUNT_UNIT = 0.0;
                clstb.ACCOUNT_INDEX = 0.0;
                clstb.EVAL_AMT = 0.0;
                clstb.EVAL_PRICE = 0.0;
                clstb.EVAL_ACCOUNT_PL = 0.0;
                clstb.TRADE_PROFIT = 0.0;
                clstb.TRADE_LOSS = 0.0;
                clstb.TRADE_TOTAL = 0.0;
                clstb.TRANSACTION_FEE = 0.0;
                clstb.ETC_PL = 0.0;
                clstb.TOTAL_ACCOUNT_PL = 0.0;
                clstb.DAILY_EVAL_PL = 0.0;
                clstb.DAILY_TOTAL_PL = 0.0;

                clstb.Insert();
	        }

        }