public void AROPartialReadings() { DateTime valueDate = new DateTime(2013, 03, 12); DateTime expiryDate = new DateTime(2013, 08, 20); double _tau = Convert.ToDouble(expiryDate.Subtract(valueDate).Days) / 365.0; double spot = 42.50; double strike = 32.36; bool isCall = true; int[] ratedays = new int[] { 1, 2925 }; double[] rateamts = new double[] { 0.044997, 0.044997 }; int[] divdays = new int[] { -918, -743, -554, -379, -190, -15 }; double[] divAmts = new double[] { 0.4400, 0.4800, 0.5200, 0.5400, 0.5800, 0.5983 }; int[] resetDays = new int[] { -38, -8, 22, 52, 82, 112, 142, 161 }; double[] resetAmts = new double[] { 42.69, 42.1, 0, 0, 0, 0, 0, 0 }; double[] volatilities = new double[] { 0.3612, 0.3612, 0.3612, 0.3612, 0.3612, 0.3612, 0.3612, 0.3612 }; ARO AROpricer = new ARO(isCall, spot, strike, _tau, volatilities, resetDays, resetAmts, ratedays, rateamts, divdays, divAmts); double pr = AROpricer.GetPrice(); Assert.AreEqual(pr, 10.28959, 0.0001); }
public void TestARO() { DateTime valueDate = new DateTime(2010, 05, 26); DateTime expiryDate = new DateTime(2013, 08, 20); double _tau = Convert.ToDouble(expiryDate.Subtract(valueDate).Days) / 365.0; double spot = 42.50; double strike = 32.36; bool isCall = true; int[] ratedays = new int[] { 1, 2925 }; double[] rateamts = new double[] { 0.044997, 0.044997 }; int[] divdays = new int[] { 103, 278, 467, 642, 831, 1006 }; double[] divAmts = new double[] { 0.4400, 0.4800, 0.5200, 0.5400, 0.5800, 0.6000 }; int[] resetDays = new int[] { 983, 1013, 1043, 1073, 1103, 1133, 1163, 1182 }; double[] resetAmts = new double[] { 0, 0, 0, 0, 0, 0, 0, 0 }; double[] volatilities = new double[] { 0.3612, 0.3612, 0.3612, 0.3612, 0.3612, 0.3612, 0.3612, 0.3612 }; ARO AROpricer = new ARO(isCall, spot, strike, _tau, volatilities, resetDays, resetAmts, ratedays, rateamts, divdays, divAmts); double pr = AROpricer.GetPrice(); Assert.AreEqual(pr, 14.8100, 0.01); }