public override QLNet.CashFlow build_ql_cf(FP_Parameter fp_parameter) { double notional = this.DAO_.NOTIONAL; QLNet.Date paymentDate = this.PaymentDate_; string index_cd = this.DAO_.FIXING_INDEX_CD; QLNet.DayCounter dayCounter = new QLNet.Actual365Fixed(); QLNet.YieldTermStructure ql_yield_ts = fp_parameter.getEvaluationCurve(index_cd); QLNet.Date accrualStartDate = this.CalculationStartDate_; QLNet.Date accrualEndDate = this.CalculationEndDate_; double forwardRate = 0.0; DateTime fixingDate = ConvertingTool.ToDateTime(this.DAO_.FIXING_DT); if (fp_parameter.CalcDate_ >= fixingDate) { if (this.DAO_.FIXED_FIXING_CALCLATED == (int)clsMAST_CF_VANILLA_FLOATING_TB.FIXED_FIXING_CALCLATED_Type.NOT_FIXED) { this.fixing_calulate(fp_parameter.CalcDate_); } // 계산함. forwardRate = this.DAO_.FIXED_FIXING; } else { forwardRate = ql_yield_ts.forwardRate(accrualStartDate, accrualEndDate, dayCounter, QLNet.Compounding.Compounded).rate(); } QLNet.CashFlow ql_cf = new QLNet.FixedRateCoupon( notional, paymentDate, forwardRate, dayCounter, accrualStartDate, accrualEndDate); return ql_cf; }
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); }
// ql_net calculation interface public override QLNet.CashFlow build_ql_cf(FP_Parameter fp_parameter) { double notional = this.DAO_.NOTIONAL; QLNet.Date paymentDate = this.PaymentDate_; double rate = this.DAO_.FIXED_RATE; QLNet.DayCounter dayCounter = new QLNet.Actual365Fixed(); QLNet.Date accrualStartDate = this.CalculationStartDate_; QLNet.Date accrualEndDate = this.CalculationEndDate_; QLNet.CashFlow ql_cf = new QLNet.FixedRateCoupon( notional, paymentDate, rate, dayCounter, accrualStartDate, accrualEndDate); return ql_cf; }
// 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); }
// 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; }