public void GetStructuredSwapMetricTest() { const string MarketName = "UnitTest"; const string Currency = "AUD"; DateTime baseDate = new DateTime(2009, 1, 6); string curveId = CreateCurve(MarketName, Currency, baseDate); const Decimal Notional = 1000000; DateTime[] dates = new DateTime[] { new DateTime(2009, 03, 05), new DateTime(2009, 06, 05), new DateTime(2009, 09, 05), new DateTime(2009, 12, 05), }; Decimal[] notionalWeights = new [] { 0.8m, 0.7m, 0.6m }; const string FixedLegDayCount = "ACT/365.FIXED"; const Decimal FixedRate = 0.06m; const string BusinessDayConvention = "FOLLOWING"; const string BusinessCentersAsString = "GBLO"; const string Metric = "DeltaR"; Decimal actual = PriceableAssets.GetStructuredSwapMetric(MarketName, curveId, Currency, baseDate, Notional, dates, notionalWeights, FixedLegDayCount, FixedRate, BusinessDayConvention, BusinessCentersAsString, Metric); const double Expected = 51.737; Assert.AreEqual(Expected, (double)actual, 0.001d); }
public void GetSwapImpliedQuoteTest() { const string marketName = "UnitTest"; const string currency = "AUD"; DateTime baseDate = new DateTime(2009, 1, 6); DateTime spotDate = new DateTime(2009, 1, 8); string curveId = CreateCurve(marketName, currency, baseDate); const string fixedLegDayCount = "ACT/365.FIXED"; const string term = "3y"; const string paymentFrequency = "1M"; const string businessDayConvention = "NONE"; const string businessCentersAsString = "GBLO"; Decimal actual = PriceableAssets.GetSwapImpliedQuote(marketName, curveId, currency, baseDate, spotDate, fixedLegDayCount, term, paymentFrequency, businessDayConvention, businessCentersAsString); const double expected = 0.0454; Assert.AreEqual(expected, (double)actual, 0.0001); }