public QLNet.YieldTermStructure yieldTSBuild() { //QLNet.YieldTermStructure ts = new QLNet.YieldTermStructure(); List <QLNet.Date> dates = new List <QLNet.Date>(); List <double> yields = new List <double>(); //ProgramVariable.ReferenceDate_.AddMonths(); foreach (var item in this.Tenor_) { int len = item.Length; string periodMultiplier = item.Substring(0, len - 1); string period = item.Substring(len - 1, 1); if (periodMultiplier == "D") { int addDays = Convert.ToInt32(period); dates.Add(ProgramVariable.ReferenceDate_.AddDays(addDays)); } else if (periodMultiplier == "M") { int addMonths = Convert.ToInt32(period); dates.Add(ProgramVariable.ReferenceDate_.AddMonths(addMonths)); } else { throw new Exception("unknown type tenor : " + item); } } foreach (var item in this.Data_) { yields.Add(Convert.ToDouble(item)); } QLNet.DayCounter dc = new QLNet.Actual365Fixed(); QLNet.InterpolatedZeroCurve <QLNet.Linear> curve = new QLNet.InterpolatedZeroCurve <QLNet.Linear>( dates, yields, dc, new QLNet.Linear()); return(curve); }
// TODO : Linear 말고 딴거는 또 구현해야함. public QLNet.YieldTermStructure yieldCurve() { List <QLNet.Date> dates = new List <QLNet.Date>(); List <double> yields = new List <double>(); foreach (var item in this.excel_rateDataViewModel_) { string tenor = item.Tenor_; int len = tenor.Length; string periodMultiplier = tenor.Substring(0, len - 1); string period = tenor.Substring(len - 1, 1); if (period == "D") { int addDays = Convert.ToInt32(periodMultiplier); dates.Add(ProgramVariable.ReferenceDate_.AddDays(addDays)); } else if (period == "M") { int addMonths = Convert.ToInt32(periodMultiplier); dates.Add(ProgramVariable.ReferenceDate_.AddMonths(addMonths)); } else { throw new Exception("unknown type tenor : " + tenor); } yields.Add(Convert.ToDouble(item.Value_)); } QLNet.DayCounter dc = new QLNet.Actual365Fixed(); QLNet.InterpolatedZeroCurve <QLNet.Linear> curve = new QLNet.InterpolatedZeroCurve <QLNet.Linear>( dates, yields, dc, new QLNet.Linear()); return(curve); }
public YieldTermStructure buildQLNet_YieldTS(Excel_irCurveDataViewModel e_irCurveData) { QLNet.YieldTermStructure ql_yts = new YieldTermStructure(); List <QLNet.Date> dates = new List <QLNet.Date>(); List <double> yields = new List <double>(); foreach (var item in e_irCurveData.Excel_rateDataViewModelList_) { string tenor = item.Tenor_; if (tenor.Substring(0, 1) == "D") { int addDays = Convert.ToInt32(tenor.Substring(1, 3)); dates.Add(ProgramVariable.ReferenceDate_.AddDays(addDays)); } else if (tenor.Substring(0, 1) == "M") { int addMonths = Convert.ToInt32(tenor.Substring(1, 3)); dates.Add(ProgramVariable.ReferenceDate_.AddMonths(addMonths)); } else { throw new Exception("unknown type tenor : " + tenor); } yields.Add(Convert.ToDouble(item.Value_)); } QLNet.DayCounter dc = new QLNet.Actual365Fixed(); QLNet.InterpolatedZeroCurve <QLNet.Linear> curve = new QLNet.InterpolatedZeroCurve <QLNet.Linear>( dates, yields, dc, new QLNet.Linear()); return(ql_yts); }
// TODO : Linear 말고 딴거는 또 구현해야함. public QLNet.YieldTermStructure yieldCurve() { List<QLNet.Date> dates = new List<QLNet.Date>(); List<double> yields = new List<double>(); foreach (var item in this.excel_rateDataViewModel_) { string tenor = item.Tenor_; int len = tenor.Length; string periodMultiplier = tenor.Substring(0, len - 1); string period = tenor.Substring(len - 1, 1); if (period == "D") { int addDays = Convert.ToInt32(periodMultiplier); dates.Add(ProgramVariable.ReferenceDate_.AddDays(addDays)); } else if (period == "M") { int addMonths = Convert.ToInt32(periodMultiplier); dates.Add(ProgramVariable.ReferenceDate_.AddMonths(addMonths)); } else { throw new Exception("unknown type tenor : " + tenor); } yields.Add(Convert.ToDouble(item.Value_)); } QLNet.DayCounter dc = new QLNet.Actual365Fixed(); QLNet.InterpolatedZeroCurve<QLNet.Linear> curve = new QLNet.InterpolatedZeroCurve<QLNet.Linear>( dates, yields, dc, new QLNet.Linear()); return curve; }
public QLNet.YieldTermStructure yieldTSBuild() { //QLNet.YieldTermStructure ts = new QLNet.YieldTermStructure(); List<QLNet.Date> dates = new List<QLNet.Date>(); List<double> yields = new List<double>(); //ProgramVariable.ReferenceDate_.AddMonths(); foreach (var item in this.Tenor_) { int len = item.Length; string periodMultiplier = item.Substring(0, len - 1); string period = item.Substring(len - 1, 1); if (periodMultiplier == "D") { int addDays = Convert.ToInt32(period); dates.Add(ProgramVariable.ReferenceDate_.AddDays(addDays)); } else if (periodMultiplier == "M") { int addMonths = Convert.ToInt32(period); dates.Add(ProgramVariable.ReferenceDate_.AddMonths(addMonths)); } else { throw new Exception("unknown type tenor : " + item); } } foreach (var item in this.Data_) { yields.Add(Convert.ToDouble(item)); } QLNet.DayCounter dc = new QLNet.Actual365Fixed(); QLNet.InterpolatedZeroCurve<QLNet.Linear> curve = new QLNet.InterpolatedZeroCurve<QLNet.Linear>( dates, yields, dc, new QLNet.Linear()); return curve; }
public YieldTermStructure buildQLNet_YieldTS(Excel_irCurveDataViewModel e_irCurveData) { QLNet.YieldTermStructure ql_yts = new YieldTermStructure(); List<QLNet.Date> dates = new List<QLNet.Date>(); List<double> yields = new List<double>(); foreach (var item in e_irCurveData.Excel_rateDataViewModelList_) { string tenor = item.Tenor_; if (tenor.Substring(0, 1) == "D") { int addDays = Convert.ToInt32(tenor.Substring(1, 3)); dates.Add(ProgramVariable.ReferenceDate_.AddDays(addDays)); } else if (tenor.Substring(0, 1) == "M") { int addMonths = Convert.ToInt32(tenor.Substring(1, 3)); dates.Add(ProgramVariable.ReferenceDate_.AddMonths(addMonths)); } else { throw new Exception("unknown type tenor : " + tenor); } yields.Add(Convert.ToDouble(item.Value_)); } QLNet.DayCounter dc = new QLNet.Actual365Fixed(); QLNet.InterpolatedZeroCurve<QLNet.Linear> curve = new QLNet.InterpolatedZeroCurve<QLNet.Linear>( dates, yields, dc, new QLNet.Linear()); return ql_yts; }