Exemple #1
0
        public void cf_insert(DateTime calcDate,
                            int seq,
                            string inst_id,
                            int inst_typ,
                            int pay_rec) 
        {
            clsHITM_FP_CASHFLOWRESULT_TB clstb = new clsHITM_FP_CASHFLOWRESULT_TB();

            clstb.FP_CASHFLOW_RESULT_ID
                = IDGenerator.getNewCashResultID(inst_id, calcDate.ToString("yyyyMMdd"), pay_rec,seq); // 생성

            clstb.NOTIONAL = this.Notional_;
            clstb.CALC_DT = calcDate.ToString("yyyyMMdd");             // 인자
            clstb.CASHFLOW_DT = this.PaymentDate_.ToString("yyyyMMdd"); // 내부
            clstb.CASHFLOW_TYP = (int)this.LEG_TYP_Type_; // 내부
            clstb.SEQ = seq; // 인자
            clstb.INSTRUMENT_ID = inst_id; //인자
            clstb.INSTRUMENT_TYP = inst_typ;
            //clstb.PAY_REC = (this.CashFlowAmount_ > 0) ? 1 : -1;
            clstb.PAY_REC = pay_rec;
            clstb.CASHFLOW = Math.Round(this.CashFlowAmount_); // 인자
            clstb.DISCOUNT_FACTOR = this.DiscountFactor_;
            clstb.CALCULATED_TIME = "999999"; // 생성

            clstb.Insert();
            //if (clstb.Insert () ) { throw new Exception("insert fail"); };
            //if (clstb.UpdateCashFlow() != 1) { throw new Exception("update fail"); };

        }
Exemple #2
0
        // 우선 pay하고 rec 구분의 문제로 나중에 구현함.. 우선 direct로 insert함.
        public void build_emptyCashFlow(DateTime refDate,string inst_id,int inst_typ,int pay_rec,int seq)
        { 
            clsHITM_FP_CASHFLOWRESULT_TB clstb = new clsHITM_FP_CASHFLOWRESULT_TB();

            clstb.FP_CASHFLOW_RESULT_ID = IDGenerator.getNewCashResultID(inst_id, refDate.ToString("yyyyMMdd"), pay_rec,seq);
            clstb.NOTIONAL = this.Notional_;
            clstb.CALC_DT = refDate.ToString("yyyyMMdd");
            clstb.CASHFLOW_DT = this.PaymentDate_.ToString("yyyyMMdd");
            clstb.CASHFLOW_TYP = (int)this.LEG_TYP_Type_;
            clstb.SEQ = seq;
            clstb.INSTRUMENT_ID = inst_id;
            clstb.INSTRUMENT_TYP = inst_typ;
            clstb.PAY_REC = pay_rec;
            clstb.CASHFLOW = 0.0;
            clstb.DISCOUNT_FACTOR = 0.0;
            clstb.CALCULATED_TIME = "999999";

            clstb.Insert();

        }
Exemple #3
0
        public virtual void build_emptyResult(DateTime refDate)
        {
            clsHITM_FP_GREEKRESULT_TB clstb = new clsHITM_FP_GREEKRESULT_TB();

            string refDateStr = refDate.ToString("yyyyMMdd");

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

            this.underlyingList(underlyingList);

            clstb.FP_GREEKRESULT_ID = IDGenerator.getNewGreekResultID(this.baseDAO_.INSTRUMENT_ID, refDateStr);
            clstb.CALC_DT = refDateStr;
            clstb.INSTRUMENT_ID = this.baseDAO_.INSTRUMENT_ID;
            clstb.INSTRUMENT_TYP = this.baseDAO_.FP_MASTER_TYP;

            int i = 1;

            foreach (string under in underlyingList)
            {
                clstb.UNDERLYING_ID = under;
                clstb.UNDERLYING_VALUE = 0.0;
                clstb.SEQ = i;
                clstb.DELTA = 0.0;
                clstb.GAMMA = 0.0;
                clstb.VEGA = 0.0;
                clstb.CALC_PRICE = 0.0;
                clstb.CALCULATED_FLAG = 0;
                clstb.CALCULATED_TIME = "";
                clstb.CALCULATE_TYP = 0;

                clstb.Insert();

                i += 1;
            }

            // SCENARIO 팀장 미친 개새끼
            clsSET_SCENARIO_TB cls_scenario = new clsSET_SCENARIO_TB();
            cls_scenario.FP_MASTER_TYP = this.baseDAO_.FP_MASTER_TYP;

            DataTable dt = cls_scenario.Select();

            foreach (DataRow dr in dt.Select())
            {
                clstb.UNDERLYING_ID = clsSET_SCENARIO_TB.Create(dr).SCENARIO_CD;
                clstb.SEQ = i;
                clstb.Insert();
                i += 1;
            }

            // 지워
            clsHITM_FP_CASHFLOWRESULT_TB clstb_cf = new clsHITM_FP_CASHFLOWRESULT_TB();

            clstb_cf.CALC_DT = refDate.ToString("yyyyMMdd");
            clstb_cf.INSTRUMENT_ID = this.baseDAO_.INSTRUMENT_ID;

            clstb_cf.DeleteInstDateCashFlow();

        }
		public clsHITM_FP_CASHFLOWRESULT_TB Clone()
		{
			try
			{
				clsHITM_FP_CASHFLOWRESULT_TB cloneTB = new clsHITM_FP_CASHFLOWRESULT_TB();
				
				
				cloneTB._FP_CASHFLOW_RESULT_ID = this._FP_CASHFLOW_RESULT_ID;
				cloneTB._NOTIONAL = this._NOTIONAL;
				cloneTB._CALC_DT = this._CALC_DT;
				cloneTB._CASHFLOW_DT = this._CASHFLOW_DT;
				cloneTB._CASHFLOW_TYP = this._CASHFLOW_TYP;
				cloneTB._SEQ = this._SEQ;
				cloneTB._INSTRUMENT_ID = this._INSTRUMENT_ID;
				cloneTB._INSTRUMENT_TYP = this._INSTRUMENT_TYP;
				cloneTB._PAY_REC = this._PAY_REC;
				cloneTB._CASHFLOW = this._CASHFLOW;
				cloneTB._DISCOUNT_FACTOR = this._DISCOUNT_FACTOR;
				cloneTB._NPV = this._NPV;
				cloneTB._CALCULATED_TIME = this._CALCULATED_TIME; 
				
				return cloneTB;
			}
			catch(Exception ex)
			{
				throw new Exception(ex.Message);
			}
		}
		public static clsHITM_FP_CASHFLOWRESULT_TB Create(DataRow dr)
		{
			try
			{
				clsHITM_FP_CASHFLOWRESULT_TB tb = new clsHITM_FP_CASHFLOWRESULT_TB();
				
				
				tb._FP_CASHFLOW_RESULT_ID = Convert.ToString(dr[0]);
				tb._NOTIONAL = Convert.ToDouble(dr[1]);
				tb._CALC_DT = Convert.ToString(dr[2]);
				tb._CASHFLOW_DT = Convert.ToString(dr[3]);
				tb._CASHFLOW_TYP = Convert.ToInt32(dr[4]);
				tb._SEQ = Convert.ToInt32(dr[5]);
				tb._INSTRUMENT_ID = Convert.ToString(dr[6]);
				tb._INSTRUMENT_TYP = Convert.ToInt32(dr[7]);
				tb._PAY_REC = Convert.ToInt32(dr[8]);
				tb._CASHFLOW = Convert.ToDouble(dr[9]);
				tb._DISCOUNT_FACTOR = Convert.ToDouble(dr[10]);
				tb._NPV = Convert.ToDouble(dr[11]);
				tb._CALCULATED_TIME = Convert.ToString(dr[12]); 
				
				return tb;
			}
			catch(Exception ex)
			{
				throw new Exception(ex.Message);
			}
		}
        public override void delete_result(string calcDateStr,string instID)
        {
            // greekresult

            clsHITM_FP_GREEKRESULT_TB clstb_greekresult = new clsHITM_FP_GREEKRESULT_TB();

            clstb_greekresult.CALC_DT = calcDateStr;
            clstb_greekresult.DeleteDate(instID);

            // cashflowresult

            clsHITM_FP_CASHFLOWRESULT_TB clstb_cashflow = new clsHITM_FP_CASHFLOWRESULT_TB();

            clstb_cashflow.CALC_DT = calcDateStr;
            clstb_cashflow.INSTRUMENT_ID = instID;
            clstb_cashflow.DeleteInstDateCashFlow();

        }