Esempio n. 1
0
 public static object[,] DoXLReport(InterestRateSwaptionPricer interestRateSwaption, bool receiveLeg)
 {
     if (interestRateSwaption != null)
     {
         if (interestRateSwaption.Swap is InterestRateSwapPricer swap)
         {
             var result = new object[swap.ReceiveLeg.Coupons.Count, 6];
             if (receiveLeg)
             {
                 var index = 0;
                 foreach (var receiveRateCoupon in swap.ReceiveLeg.Coupons)
                 {
                     result[index, 0] = "ReceiveLeg_Coupon_" + index;
                     result[index, 1] = receiveRateCoupon.PriceableCouponType.ToString();
                     result[index, 2] = receiveRateCoupon.PaymentDate;
                     result[index, 3] = receiveRateCoupon.NotionalAmount.amount;
                     result[index, 4] = receiveRateCoupon.Rate;
                     result[index, 5] = receiveRateCoupon.PaymentAmount.amount;
                     index++;
                 }
             }
             else
             {
                 var index       = 0;
                 var secondIndex = 0;
                 foreach (var payRateCoupon in swap.PayLeg.Coupons)
                 {
                     result[index, 0] = "PayLeg_Coupon_" + secondIndex;
                     result[index, 1] = payRateCoupon.PriceableCouponType.ToString();
                     result[index, 2] = payRateCoupon.PaymentDate;
                     result[index, 3] = payRateCoupon.NotionalAmount.amount;
                     result[index, 4] = payRateCoupon.Rate;
                     result[index, 5] = payRateCoupon.PaymentAmount.amount;
                     index++;
                     secondIndex++;
                 }
             }
         }
     }
     return(null);
 }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="logger"></param>
        /// <param name="cache"></param>
        /// <param name="nameSpace"></param>
        /// <param name="legCalendars"></param>
        /// <param name="trade"></param>
        /// <param name="tradeProps"></param>
        /// <param name="forecastRateInterpolation"></param>
        public TradePricer(ILogger logger, ICoreCache cache, String nameSpace,
                           List <Pair <IBusinessCalendar, IBusinessCalendar> > legCalendars,
                           Trade trade, NamedValueSet tradeProps, bool forecastRateInterpolation)
        {
            if (tradeProps == null)
            {
                tradeProps = new NamedValueSet();//TODO Need to generate properties for the FpML examples.
            }
            var tradeIdentifier = new TradeIdentifier(tradeProps);

            TradeIdentifier = tradeIdentifier;
            TradeHeader     = trade.tradeHeader;
            //Get the baseParty, which in GWML is the originating party.
            BaseParty = tradeProps.GetValue <string>(TradeProp.BaseParty, false) ?? TradeProp.Party1;
            var party1 = tradeProps.GetValue <string>(TradeProp.Party1, true);
            var party2 = tradeProps.GetValue <string>(TradeProp.Party2, true);

            Parties = new List <Party> {
                new Party {
                    partyName = new PartyName {
                        Value = party1
                    }
                }, new Party {
                    partyName = new PartyName {
                        Value = party2
                    }
                }
            };
            TradeType = trade.ItemElementName;
            //Determine the product type, so that the appropriate productPricer can be instantiated.
            //Set the product type
            var productType = tradeIdentifier.ProductType;
            //Check whether the business calendars list is null.
            Pair <IBusinessCalendar, IBusinessCalendar> firstCalendarPair = null;

            if (legCalendars?.Count > 0)
            {
                firstCalendarPair = legCalendars[0];
            }
            //Instantiate the productPricer.
            if (productType != null && productType != ProductTypeSimpleEnum.Undefined)
            {
                ProductType = (ProductTypeSimpleEnum)productType;
                switch (ProductType)
                {
                case ProductTypeSimpleEnum.PropertyTransaction:
                {
                    IBusinessCalendar settlementCalendar = null;
                    if (firstCalendarPair != null)
                    {
                        settlementCalendar = firstCalendarPair.First;
                    }
                    var property          = (PropertyTransaction)trade.Item;
                    var tradeDate         = tradeProps.GetValue <DateTime>(TradeProp.TradeDate, false);
                    var referenceProperty = tradeProps.GetValue <String>(PropertyProp.ReferenceProperty, false);
                    //Get the instrument configuration data.
                    //Modify the pricer to include this data.
                    PriceableProduct = new PropertyTransactionPricer(logger, cache, nameSpace, tradeDate, referenceProperty, settlementCalendar, property, BaseParty, forecastRateInterpolation);
                    ProductReporter  = new PropertyTransactionReporter();
                }
                break;

                case ProductTypeSimpleEnum.EquityTransaction:
                {
                    IBusinessCalendar settlementCalendar = null;
                    if (firstCalendarPair != null)
                    {
                        settlementCalendar = firstCalendarPair.First;
                    }
                    var equity          = (EquityTransaction)trade.Item;
                    var tradeDate       = tradeProps.GetValue <DateTime>(TradeProp.TradeDate, true);
                    var effectiveDate   = tradeProps.GetValue <DateTime>(TradeProp.EffectiveDate, true);
                    var referenceEquity = tradeProps.GetValue <String>(EquityProp.ReferenceEquity, false);
                    //Get the instrument configuration data.
                    //Modify the pricer to include this data.
                    PriceableProduct = new EquityTransactionPricer(logger, cache, nameSpace, tradeDate, effectiveDate, referenceEquity, settlementCalendar, equity, BaseParty, forecastRateInterpolation);
                    ProductReporter  = new EquityTransactionReporter();
                }
                break;

                case ProductTypeSimpleEnum.BondTransaction:
                {
                    IBusinessCalendar settlementCalendar = null;
                    if (firstCalendarPair != null)
                    {
                        settlementCalendar = firstCalendarPair.First;
                    }
                    var bond          = (BondTransaction)trade.Item;
                    var tradeDate     = tradeProps.GetValue <DateTime>(TradeProp.TradeDate, true);
                    var effectiveDate = tradeProps.GetValue <DateTime>(TradeProp.EffectiveDate, true);
                    var bondType      = tradeProps.GetValue <string>(BondProp.BondType, false);
                    //Get the instrument configuration data.
                    //Modify the pricer to include this data.
                    PriceableProduct = new BondTransactionPricer(logger, cache, nameSpace, tradeDate, effectiveDate, settlementCalendar, settlementCalendar, bond, BaseParty, bondType, forecastRateInterpolation);
                    ProductReporter  = new BondTransactionReporter();
                }
                break;

                case ProductTypeSimpleEnum.FutureTransaction:
                {
                    IBusinessCalendar settlementCalendar = null;
                    if (firstCalendarPair != null)
                    {
                        settlementCalendar = firstCalendarPair.First;
                    }
                    var future     = (FutureTransaction)trade.Item;
                    var tradeDate  = tradeProps.GetValue <DateTime>(TradeProp.TradeDate, false);
                    var type       = tradeProps.GetValue <String>(FuturesProp.FuturesType, true);
                    var futureType = EnumHelper.Parse <ExchangeContractTypeEnum>(type);
                    //Get the instrument configuration data.
                    //Modify the pricer to include this data.
                    PriceableProduct = new FutureTransactionPricer(logger, cache, nameSpace, tradeDate, futureType, settlementCalendar, future, BaseParty, forecastRateInterpolation);
                    ProductReporter  = new FutureTransactionReporter();
                }
                break;

                case ProductTypeSimpleEnum.InterestRateSwap:
                {
                    var swap = (Swap)trade.Item;
                    PriceableProduct = new InterestRateSwapPricer(logger, cache, nameSpace, legCalendars, swap, BaseParty, forecastRateInterpolation);
                    ProductReporter  = new InterestRateSwapReporter();
                }
                break;

                case ProductTypeSimpleEnum.AssetSwap:
                {
                    var swap = (Swap)trade.Item;
                    //TODO set for the payer. This needs to be modified for the base counterparty.
                    PriceableProduct = new AssetSwapPricer(logger, cache, nameSpace, legCalendars, swap, BaseParty, new Bond(), forecastRateInterpolation);
                    ProductReporter  = new InterestRateSwapReporter();
                }
                break;

                case ProductTypeSimpleEnum.CrossCurrencySwap:
                {
                    var swap = (Swap)trade.Item;
                    //TODO set for the payer. This needs to be modified for the base counterparty.
                    PriceableProduct = new CrossCurrencySwapPricer(logger, cache, nameSpace, legCalendars, swap, BaseParty, forecastRateInterpolation);
                    ProductReporter  = new InterestRateSwapReporter();
                }
                break;

                case ProductTypeSimpleEnum.FRA:     // todo
                {
                    var fra = (Fra)trade.Item;
                    IBusinessCalendar fixingCalendar  = null;
                    IBusinessCalendar paymentCalendar = null;
                    if (firstCalendarPair != null)
                    {
                        fixingCalendar  = firstCalendarPair.First;
                        paymentCalendar = firstCalendarPair.Second;
                    }
                    PriceableProduct = new FraPricer(logger, cache, fixingCalendar, paymentCalendar, fra, BaseParty, nameSpace)
                    {
                        ForecastRateInterpolation = forecastRateInterpolation
                    };
                    ProductReporter = new ForwardRateAgreementReporter();
                }
                break;

                //case ProductTypeSimpleEnum.InflationSwap:
                //    break;
                //case ProductTypeSimpleEnum.CreditDefaultSwap:
                //    break;
                //case ProductTypeSimpleEnum.TotalReturnSwap:
                //    break;
                //case ProductTypeSimpleEnum.VarianceSwap:
                //    break;
                case ProductTypeSimpleEnum.CapFloor:
                {
                    var capFloor = (CapFloor)trade.Item;
                    IBusinessCalendar fixingCalendar  = null;
                    IBusinessCalendar paymentCalendar = null;
                    if (firstCalendarPair != null)
                    {
                        fixingCalendar  = firstCalendarPair.First;
                        paymentCalendar = firstCalendarPair.Second;
                    }
                    PriceableProduct = new CapFloorPricer(logger, cache, nameSpace, fixingCalendar, paymentCalendar, capFloor, BaseParty);
                    ProductReporter  = new CapFloorReporter();
                }
                break;

                case ProductTypeSimpleEnum.FxSpot:
                {
                    var fxForward = (FxSingleLeg)trade.Item;
                    PriceableProduct = new FxSingleLegPricer(fxForward, BaseParty, ProductTypeSimpleEnum.FxSpot);
                    ProductReporter  = new FxSingleLegReporter();
                }
                break;

                case ProductTypeSimpleEnum.FxForward:
                {
                    var fxForward = (FxSingleLeg)trade.Item;
                    PriceableProduct = new FxSingleLegPricer(fxForward, BaseParty, ProductTypeSimpleEnum.FxForward);
                    ProductReporter  = new FxSingleLegReporter();
                }
                break;

                case ProductTypeSimpleEnum.BulletPayment:
                {
                    if (trade.Item is BulletPayment bullet)
                    {
                        IBusinessCalendar paymentCalendar = null;
                        if (firstCalendarPair != null)
                        {
                            paymentCalendar = firstCalendarPair.Second;
                        }
                        //The calendars
                        if (paymentCalendar == null)
                        {
                            if (bullet.payment.paymentDate != null)
                            {
                                var containsPaymentDateAdjustments = AdjustableOrAdjustedDateHelper.Contains(bullet.payment.paymentDate, ItemsChoiceType.dateAdjustments, out object dateAdjustments);
                                if (containsPaymentDateAdjustments && dateAdjustments != null)
                                {
                                    paymentCalendar = BusinessCenterHelper.ToBusinessCalendar(cache, ((BusinessDayAdjustments)dateAdjustments).
                                                                                              businessCenters, nameSpace);
                                }
                            }
                        }
                        PriceableProduct = new BulletPaymentPricer(bullet, BaseParty, paymentCalendar);
                        ProductReporter  = new BulletPaymentReporter();
                    }
                }
                break;

                case ProductTypeSimpleEnum.FxSwap:
                {
                    var fxSwap = (FxSwap)trade.Item;
                    PriceableProduct = new FxSwapPricer(fxSwap, BaseParty);
                    ProductReporter  = new FxSwapReporter();
                }
                break;

                //case ProductTypeSimpleEnum.EquityOption:
                //    break;
                //case ProductTypeSimpleEnum.BondOption:
                //    break;
                case ProductTypeSimpleEnum.FxOption:
                {
                    IBusinessCalendar fixingCalendar  = null;
                    IBusinessCalendar paymentCalendar = null;
                    if (firstCalendarPair != null)
                    {
                        fixingCalendar  = firstCalendarPair.First;
                        paymentCalendar = firstCalendarPair.Second;
                    }
                    var fxOption = (FxOption)trade.Item;
                    PriceableProduct = new VanillaEuropeanFxOptionPricer(logger, cache, nameSpace, fixingCalendar, paymentCalendar, fxOption, BaseParty);
                    ProductReporter  = new FxOptionLegReporter();
                }
                break;

                //case ProductTypeSimpleEnum.FxOptionStrategy:
                //    break;
                //case ProductTypeSimpleEnum.CreditDefaultIndex:
                //    break;
                //case ProductTypeSimpleEnum.CreditDefaultIndexTranche:
                //    break;
                //case ProductTypeSimpleEnum.CreditDefaultBasket:
                //    break;
                //case ProductTypeSimpleEnum.CreditDefaultBasketTranche:
                //    break;
                //case ProductTypeSimpleEnum.CreditDefaultOption:
                //    break;
                //case ProductTypeSimpleEnum.EquityForward:
                //    break;
                case ProductTypeSimpleEnum.InterestRateSwaption:
                {
                    var interestRateSwaption = (Swaption)trade.Item;
                    PriceableProduct = new InterestRateSwaptionPricer(logger, cache, nameSpace, interestRateSwaption, BaseParty, forecastRateInterpolation);
                    ProductReporter  = new InterestRateSwaptionReporter();
                }
                break;

                case ProductTypeSimpleEnum.TermDeposit:
                {
                    //var party1 = tradeProps.GetValue<string>(TradeProp.Party1, true);
                    //var party2 = tradeProps.GetValue<string>(TradeProp.Party2, true);
                    //var reportingParty = baseParty == party1 ? "Party1" : "Party2"; // TODO this is for backward compatability.
                    var deposit = (TermDeposit)trade.Item;
                    PriceableProduct = new TermDepositPricer(logger, cache, deposit, TradeProp.Party1);        //The payment date must be correct before calling this!
                    ProductReporter  = new TermDepositReporter();
                }
                break;

                //case ProductTypeSimpleEnum.DividendSwap:
                //    break;
                //case ProductTypeSimpleEnum.ConvertibleBondOption:
                //    break;
                //case ProductTypeSimpleEnum.Loan:
                //    break;
                //case ProductTypeSimpleEnum.Repo:
                //    break;
                default:
                    throw new NotSupportedException("Unsupported ProductType: " + ProductType);
                }
            }
            else
            {
                switch (TradeType)
                {
                case ItemChoiceType15.propertyTransaction:
                {
                    var equity = (PropertyTransaction)trade.Item;
                    IBusinessCalendar settlementCalendar = null;
                    if (firstCalendarPair != null)
                    {
                        settlementCalendar = firstCalendarPair.First;
                    }
                    var tradeDate         = tradeProps.GetValue <DateTime>(TradeProp.TradeDate, false);
                    var referenceProperty = tradeProps.GetValue <String>(PropertyProp.ReferenceProperty, false);
                    PriceableProduct = new PropertyTransactionPricer(logger, cache, nameSpace, tradeDate, referenceProperty, settlementCalendar, equity, BaseParty, forecastRateInterpolation);
                    ProductReporter  = new PropertyTransactionReporter();
                }
                break;

                case ItemChoiceType15.equityTransaction:
                {
                    var equity = (EquityTransaction)trade.Item;
                    IBusinessCalendar settlementCalendar = null;
                    if (firstCalendarPair != null)
                    {
                        settlementCalendar = firstCalendarPair.First;
                    }
                    var tradeDate       = tradeProps.GetValue <DateTime>(TradeProp.TradeDate, false);
                    var effectiveDate   = tradeProps.GetValue <DateTime>(TradeProp.EffectiveDate, true);
                    var referenceEquity = tradeProps.GetValue <String>(EquityProp.ReferenceEquity, false);
                    PriceableProduct = new EquityTransactionPricer(logger, cache, nameSpace, tradeDate, effectiveDate, referenceEquity, settlementCalendar, equity, BaseParty, forecastRateInterpolation);
                    ProductReporter  = new EquityTransactionReporter();
                }
                break;

                case ItemChoiceType15.bondTransaction:
                {
                    var bond = (BondTransaction)trade.Item;
                    IBusinessCalendar settlementCalendar = null;
                    IBusinessCalendar paymentCalendar    = null;
                    if (firstCalendarPair != null)
                    {
                        settlementCalendar = firstCalendarPair.First;
                        paymentCalendar    = firstCalendarPair.Second;
                    }
                    var tradeDate     = tradeProps.GetValue <DateTime>(TradeProp.TradeDate, true);
                    var effectiveDate = tradeProps.GetValue <DateTime>(TradeProp.EffectiveDate, true);
                    var bondType      = tradeProps.GetValue <string>(BondProp.BondType, false);
                    PriceableProduct = new BondTransactionPricer(logger, cache, nameSpace, tradeDate, effectiveDate, settlementCalendar, paymentCalendar, bond, BaseParty, bondType, forecastRateInterpolation);
                    ProductReporter  = new BondTransactionReporter();
                }
                break;

                case ItemChoiceType15.futureTransaction:
                {
                    IBusinessCalendar settlementCalendar = null;
                    if (firstCalendarPair != null)
                    {
                        settlementCalendar = firstCalendarPair.First;
                    }
                    var future     = (FutureTransaction)trade.Item;
                    var tradeDate  = tradeProps.GetValue <DateTime>(TradeProp.TradeDate, false);
                    var type       = tradeProps.GetValue <String>(FuturesProp.FuturesType, true);
                    var futureType = EnumHelper.Parse <ExchangeContractTypeEnum>(type);
                    //Get the instrument configuration data.
                    //Modify the pricer to include this data.
                    PriceableProduct = new FutureTransactionPricer(logger, cache, nameSpace, tradeDate, futureType, settlementCalendar, future, BaseParty, forecastRateInterpolation);
                    ProductReporter  = new FutureTransactionReporter();
                }
                break;

                case ItemChoiceType15.swap:
                {
                    var swap = (Swap)trade.Item;
                    //TODO this needs to be emnhanced
                    ProductType      = ProductTypeSimpleEnum.InterestRateSwap;
                    PriceableProduct = new CrossCurrencySwapPricer(logger, cache, nameSpace, legCalendars, swap, BaseParty, forecastRateInterpolation);
                    ProductReporter  = new InterestRateSwapReporter();
                    //var report =
                }
                break;

                case ItemChoiceType15.fra:     // todo
                {
                    var fra = (Fra)trade.Item;
                    IBusinessCalendar fixingCalendar  = null;
                    IBusinessCalendar paymentCalendar = null;
                    if (firstCalendarPair != null)
                    {
                        fixingCalendar  = firstCalendarPair.First;
                        paymentCalendar = firstCalendarPair.Second;
                    }
                    ProductType      = ProductTypeSimpleEnum.FRA;
                    PriceableProduct = new FraPricer(logger, cache, fixingCalendar, paymentCalendar, fra, BaseParty)
                    {
                        ForecastRateInterpolation = forecastRateInterpolation
                    };
                    ProductReporter = new ForwardRateAgreementReporter();
                }
                break;

                case ItemChoiceType15.capFloor:
                {
                    var capFloor = (CapFloor)trade.Item;
                    IBusinessCalendar fixingCalendar  = null;
                    IBusinessCalendar paymentCalendar = null;
                    if (firstCalendarPair != null)
                    {
                        fixingCalendar  = firstCalendarPair.First;
                        paymentCalendar = firstCalendarPair.Second;
                    }
                    ProductType      = ProductTypeSimpleEnum.CapFloor;
                    PriceableProduct = new CapFloorPricer(logger, cache, nameSpace, fixingCalendar, paymentCalendar, capFloor, BaseParty);
                    ProductReporter  = new CapFloorReporter();
                }
                break;

                case ItemChoiceType15.fxSingleLeg:
                {
                    var fxForward = (FxSingleLeg)trade.Item;
                    ProductType      = ProductTypeSimpleEnum.FxSpot;
                    PriceableProduct = new FxSingleLegPricer(fxForward, BaseParty, ProductType);
                    ProductReporter  = new FxSingleLegReporter();
                }
                break;

                case ItemChoiceType15.fxSwap:
                {
                    var fxSwap = (FxSwap)trade.Item;
                    ProductType      = ProductTypeSimpleEnum.FxSwap;
                    PriceableProduct = new FxSwapPricer(fxSwap, BaseParty);
                    ProductReporter  = new FxSwapReporter();
                }
                break;

                case ItemChoiceType15.bulletPayment:
                {
                    if (trade.Item is BulletPayment bullet)
                    {
                        IBusinessCalendar paymentCalendar = null;
                        if (firstCalendarPair != null)
                        {
                            paymentCalendar = firstCalendarPair.Second;
                        }
                        //The calendars
                        if (paymentCalendar == null)
                        {
                            if (bullet.payment.paymentDate != null)
                            {
                                var containsPaymentDateAdjustments = AdjustableOrAdjustedDateHelper.Contains(bullet.payment.paymentDate, ItemsChoiceType.dateAdjustments, out object dateAdjustments);
                                if (containsPaymentDateAdjustments && dateAdjustments != null)
                                {
                                    paymentCalendar = BusinessCenterHelper.ToBusinessCalendar(cache, ((BusinessDayAdjustments)dateAdjustments).
                                                                                              businessCenters, nameSpace);
                                }
                            }
                        }
                        ProductType      = ProductTypeSimpleEnum.BulletPayment;
                        PriceableProduct = new BulletPaymentPricer(bullet, BaseParty, paymentCalendar);
                        ProductReporter  = new BulletPaymentReporter();
                    }
                }
                break;

                case ItemChoiceType15.termDeposit:
                {
                    var deposit = (TermDeposit)trade.Item;
                    ProductType      = ProductTypeSimpleEnum.TermDeposit;
                    PriceableProduct = new TermDepositPricer(logger, cache, deposit, TradeProp.Party1);        //The payment date must be correct before calling this!
                    ProductReporter  = new TermDepositReporter();
                }
                break;

                case ItemChoiceType15.swaption:
                {
                    var interestRateSwaption = (Swaption)trade.Item;
                    ProductType      = ProductTypeSimpleEnum.InterestRateSwaption;
                    PriceableProduct = new InterestRateSwaptionPricer(logger, cache, nameSpace, interestRateSwaption, BaseParty, forecastRateInterpolation);
                    ProductReporter  = new InterestRateSwaptionReporter();
                }
                break;

                case ItemChoiceType15.fxOption:
                {
                    IBusinessCalendar fixingCalendar  = null;
                    IBusinessCalendar paymentCalendar = null;
                    if (firstCalendarPair != null)
                    {
                        fixingCalendar  = firstCalendarPair.First;
                        paymentCalendar = firstCalendarPair.Second;
                    }
                    var fxOption = (FxOption)trade.Item;
                    ProductType      = ProductTypeSimpleEnum.FxOption;
                    PriceableProduct = new VanillaEuropeanFxOptionPricer(logger, cache, nameSpace, fixingCalendar, paymentCalendar, fxOption, BaseParty);
                    ProductReporter  = new FxOptionLegReporter();
                }
                break;

                default:
                    throw new NotSupportedException("Unsupported TradeType: " + TradeType);
                }
                //Adds the extra party info now required.
                PriceableProduct.OrderedPartyNames.Add(party1);
                PriceableProduct.OrderedPartyNames.Add(party2);
                //Check if collateralised
                if (trade.collateral != null)
                {
                    PriceableProduct.IsCollateralised = true;
                }
            }
        }
        public void CreateSwaptionValuation()
        {
            DateTime valuationDate = DateTime.Today;

            SwaptionPricer irSwaptionPricer = new InterestRateSwaptionPricer();

            string discountCurveID   = BuildAndCacheRateCurve(valuationDate); //RateCurveExcelInterfaceTests.ExcelInterface_CreateAUDCurveFromDepostSwapsFuturesFras_WithDates(valuationDate, valuationDate);
            string projectionCurveID = discountCurveID;

            SwapLegParametersRange_Old payFixed       = CreateFixedAUD_6MSwapLegParametersRange(_NAB, CounterParty, valuationDate, 0.065m, "ACT/365.FIXED", "AUSY", "FOLLOWING", "AUSY", "NONE", discountCurveID);
            SwapLegParametersRange_Old receiveFloat   = CreateFloatingAUD_6MSwapLegParametersRange(CounterParty, _NAB, valuationDate, 0, "ACT/365.FIXED", "AUSY", "FOLLOWING", "AUSY", "NONE", discountCurveID, projectionCurveID);
            ValuationRange             valuationRange = CreateValuationRangeForNAB(valuationDate);
            var payCFRangeItemList = InterestRateSwapPricer.GetDetailedCashflowsTestOnly(Engine.Logger, Engine.Cache, Engine.NameSpace, payFixed, valuationRange);

            payCFRangeItemList[0].CouponType = "fixed"; // that should test case insensitive nature of coupons
            payCFRangeItemList[1].CouponType = "Fixed"; //
            var receiveCFRangeItemList = InterestRateSwapPricer.GetDetailedCashflowsTestOnly(Engine.Logger, Engine.Cache, Engine.NameSpace, receiveFloat, valuationRange);

            receiveCFRangeItemList[0].CouponType = "float"; // that should test case insensitive nature of coupons
            receiveCFRangeItemList[1].CouponType = "Float"; //
            var tradeRange = new TradeRange {
                Id = "TradeId_12345", TradeDate = valuationDate
            };
            var leg1PrincipalExchangeCashflowList = new List <InputPrincipalExchangeCashflowRangeItem>();
            var leg2PrincipalExchangeCashflowList = new List <InputPrincipalExchangeCashflowRangeItem>();
            var leg1BulletPaymentList             = new List <AdditionalPaymentRangeItem>();
            var leg2BulletPaymentList             = new List <AdditionalPaymentRangeItem>();
            var swaptionParametersRange           = new SwaptionParametersRange
            {
                Premium                = 456789.12m,
                PremiumCurrency        = "AUD",
                PremiumPayer           = CounterParty,
                PremiumReceiver        = _NAB,
                ExpirationDate         = valuationDate.AddDays(10),
                ExpirationDateCalendar = "AUSY-GBLO",
                ExpirationDateBusinessDayAdjustments = "FOLLOWING",
                PaymentDate         = valuationDate.AddDays(20),
                PaymentDateCalendar = "USNY-GBLO",
                PaymentDateBusinessDayAdjustments = "MODFOLLOWING",
                EarliestExerciseTime = new TimeSpan(10, 0, 0).TotalDays,
                ExpirationTime       = new TimeSpan(11, 0, 0).TotalDays,
                AutomaticExcercise   = false
            };
            List <PartyIdRangeItem>           partyList = GetPartyList("NAB", "book", "MCHammer", "counterparty");
            List <OtherPartyPaymentRangeItem> otherPartyPaymentRangeItems = GetOtherPartyPaymentList("counterparty", "cost center");
            List <FeePaymentRangeItem>        feePaymentRangeItems        = GetFeeList("counterparty", "book");
            //  Get price and swap representation using non-vanilla PRICE function.
            //
            string valuatonId = irSwaptionPricer.CreateValuation(Engine.Logger, Engine.Cache, Engine.NameSpace, null, null,
                                                                 swaptionParametersRange,
                                                                 CreateValuationSetList2(12345.67, -0.321), valuationRange, tradeRange,
                                                                 payFixed, receiveFloat,
                                                                 payCFRangeItemList, receiveCFRangeItemList,
                                                                 leg1PrincipalExchangeCashflowList, leg2PrincipalExchangeCashflowList,
                                                                 leg1BulletPaymentList, leg2BulletPaymentList,
                                                                 partyList, otherPartyPaymentRangeItems,
                                                                 feePaymentRangeItems);
            var valuationReport = Engine.Cache.LoadObject <ValuationReport>(Engine.NameSpace + "." + valuatonId);

            Debug.Print(XmlSerializerHelper.SerializeToString(valuationReport));
        }