public void curveData(CurveDefInfo curveDefInfo, CurveShift curveShift, DateTime preDate, DateTime nextDate) { clsHDAT_CURVEDATA_TB clstb = new clsHDAT_CURVEDATA_TB(); //clstb.CURVE_CD = curveDefInfo.Name_; //DataTable tb = clstb.Select(); int seq = 1; clstb.REF_DT = nextDate.ToString("yyyyMMdd"); clstb.CURVE_CD = curveDefInfo.Name_; for (int i = 0; i < curveDefInfo.Tenor_.Count; i++) { clstb.TENOR = curveDefInfo.Tenor_[i]; clstb.TENOR_SEQ = seq; clstb.RATE = curveDefInfo.InitialCurve_[i]; clstb.RATE_TYP = (int)clsHDAT_CURVEDATA_TB.RATE_TYP_Type.SWAP; seq += 1; clstb.Insert(); } }
public void build_curveHistoryData(DateTime startDate, DateTime endDate,bool withClear) { CalendarManager cm = new CalendarManager(DateTime.Now, CalendarManager.CountryType.SOUTH_KOREA); clsHDAT_CURVEDATA_TB clstb = new clsHDAT_CURVEDATA_TB(); CurveShift curveShift = new CurveShift(); foreach (CurveDefInfo cdi in this.sampleCurve_) { clstb.CURVE_CD = cdi.Name_; if (withClear) { clstb.DeleteIndex(); clstb.REF_DT = startDate.ToString("yyyyMMdd"); for (int i = 0; i < cdi.Tenor_.Count; i++) { clstb.TENOR = cdi.Tenor_[i]; clstb.TENOR_SEQ = i+1; clstb.RATE_TYP = (int)clsHDAT_CURVEDATA_TB.RATE_TYP_Type.SWAP; clstb.RATE = cdi.InitialCurve_[i]; } } clstb.Insert(); DateTime roopDate = startDate; DateTime nextDate = cm.adjust(roopDate, "1D"); while (nextDate < endDate) { clstb.REF_DT = roopDate.ToString("yyyyMMdd"); nextDate = cm.adjust(roopDate, "1D"); this.curveData(cdi, curveShift, roopDate, nextDate); roopDate = nextDate; } } }