/// <summary> /// Evaluates the implied quote. /// </summary> /// <returns></returns> private Decimal EvaluateImpliedQuote() { var impliedRate = EvaluateImpliedRate(); var result = FuturesAnalytics.FuturesImpliedQuoteFromMarginAdjusted(impliedRate, (double)AnalyticParameters.TimeToExpiry, (double)AnalyticParameters.Volatility); return(result); }
public void TestFuturesMarginConvexityAdjustment() { for (var i = 0; i < 10; i++) { var rate = (decimal)(50 + i); var cvt = FuturesAnalytics.FuturesMarginConvexityAdjustment(rate / 1000, 3.0, .2); var result = FuturesAnalytics.FuturesImpliedQuoteFromMarginAdjusted(rate / 1000 - cvt, 3.0, .2); Debug.WriteLine(String.Format("rate : {0} convexity: {1} implied: {2}", rate / 1000, cvt * 10000, result)); } decimal actual = FuturesAnalytics.FuturesMarginConvexityAdjustment(0.055m, 3d, 0.2); Assert.AreEqual(0.0004788059284411, (double)actual, 0.000000001); actual = FuturesAnalytics.FuturesMarginConvexityAdjustment(0.055m, 0, 0.2); Assert.AreEqual(0, actual); }
public void FuturesImpliedQuoteFromMarginAdjustedTest() { for (var i = 0; i < 10; i++) { decimal rate = 50 + i; decimal adjustedRate = FuturesAnalytics.FuturesImpliedQuoteFromMarginAdjusted(rate / 1000, 3.0, .2); decimal arrearsAdjustedRate = FuturesAnalytics.FuturesImpliedQuoteWithArrears(adjustedRate, 0.25, 3.0, .2); decimal cvt = FuturesAnalytics.FuturesImpliedQuoteFromMarginAdjustedWithArrears(arrearsAdjustedRate, 3.0, 0.25, .2); Assert.AreEqual((double)rate / 1000, (double)cvt, 0.01); Debug.WriteLine(String.Format("rate : {0} adjustedRate: {1} arrearsAdjustedRate: {2} cvt: {3}", rate / 1000, adjustedRate, arrearsAdjustedRate, cvt)); } decimal actual = FuturesAnalytics.FuturesImpliedQuoteFromMarginAdjusted(0.055m, 3, 0.2); Assert.AreEqual(0.055486651d, (double)actual, 0.000000001); actual = FuturesAnalytics.FuturesImpliedQuoteFromMarginAdjusted(0.055m, 0, 0.2); Assert.AreEqual(0.055m, actual); }
/// <summary> /// Evaluates the implied futures quote from a provided convexity adjusted forward. /// This currently only works for margined futures without an arrears adjustment. /// </summary> /// <param name="impliedRate"></param> /// <param name="timeToExpiry"></param> /// <param name="volatility"></param> /// <returns></returns> public decimal FuturesImpliedQuoteFromMarginAdjusted(decimal impliedRate, double timeToExpiry, double volatility) { return(FuturesAnalytics.FuturesImpliedQuoteFromMarginAdjusted(impliedRate, timeToExpiry, volatility)); }