public static ResultStore GetRiskMeasures(this BesaJseBond bond, Date settleDate, double ytm) { var riskmeasures = new ResultStore(); riskmeasures.Add(Keys.Delta, bond.Delta(settleDate, ytm)); riskmeasures.Add(Keys.RandsPerPoint, bond.RandsPerPoint(settleDate, ytm)); riskmeasures.Add(Keys.Duration, bond.Duration(settleDate, ytm)); riskmeasures.Add(Keys.ModifiedDuration, bond.ModefiedDuration(settleDate, ytm)); riskmeasures.Add(Keys.Convexity, bond.Convexity(settleDate, ytm)); return(riskmeasures); }
/// <summary> /// /// </summary> /// <param name="bond"></param> /// <param name="settleDate"></param> /// <param name="ytm"></param> /// <returns>duration of the bond</returns> public static double Duration(this BesaJseBond bond, Date settleDate, double ytm) { var v = 1 / (1 + ytm / 2); return(bond.ModefiedDuration(settleDate, ytm) / v); }