public double CalculateParRate(IFundingModel Model) { var rateStart = Expiry.AddPeriod(RollType.F, Index.HolidayCalendars, Index.FixingOffset); var rateEnd = rateStart.AddPeriod(Index.RollConvention, Index.HolidayCalendars, Index.ResetTenor); var forecastCurve = Model.Curves[ForecastCurve]; var fwdRate = forecastCurve.GetForwardRate(rateStart, rateEnd, RateType.Linear, Index.DayCountBasis); var fairPrice = 100.0 - (fwdRate + ConvexityAdjustment) * 100.0; return(fairPrice); }
public double Pv(FundingModel Model, bool updateState) { var rateStart = Expiry.AddPeriod(RollType.F, Index.HolidayCalendars, Index.FixingOffset); var rateEnd = rateStart.AddPeriod(Index.RollConvention, Index.HolidayCalendars, Index.ResetTenor); var forecastCurve = Model.Curves[ForecastCurve]; var fwdRate = forecastCurve.GetForwardRate(rateStart, rateEnd, RateType.Linear, Index.DayCountBasis); var fairPrice = 100.0 - (fwdRate + ConvexityAdjustment) * 100.0; var PV = (Price - fairPrice) * Position * ContractSize * DCF; return(PV); }
public Dictionary <string, Dictionary <DateTime, double> > Sensitivities(FundingModel model) { //only forecast for STIR future var forecastDict = new Dictionary <DateTime, double>(); var forecastCurve = model.Curves[ForecastCurve]; var rateStart = Expiry.AddPeriod(RollType.F, Index.HolidayCalendars, Index.FixingOffset); var rateEnd = rateStart.AddPeriod(Index.RollConvention, Index.HolidayCalendars, Index.ResetTenor); var ts = forecastCurve.Basis.CalculateYearFraction(forecastCurve.BuildDate, rateStart); var te = forecastCurve.Basis.CalculateYearFraction(forecastCurve.BuildDate, rateEnd); var fwdRate = forecastCurve.GetForwardRate(rateStart, rateEnd, RateType.Linear, Index.DayCountBasis); var dPVdR = -100.0; var dPVdS = dPVdR * (-ts * (fwdRate + 1.0 / DCF)); var dPVdE = dPVdR * (te * (fwdRate + 1.0 / DCF)); forecastDict.Add(rateStart, dPVdS); forecastDict.Add(rateEnd, dPVdE); return(new Dictionary <string, Dictionary <DateTime, double> >() { { ForecastCurve, forecastDict }, }); }