/// <summary>
 ///
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="cache">The cache.</param>
 /// <param name="baseParty">THe base party is either Party1 or Party2</param>
 /// <param name="depositFpML">THe FpML representation of the deposit correctly built.</param>
 public TermDepositPricer(ILogger logger, ICoreCache cache, TermDeposit depositFpML, string baseParty)
 {
     Multiplier        = 1.0m;
     OrderedPartyNames = new List <string>();
     FixedRate         = depositFpML.fixedRate;
     EffectiveDate     = depositFpML.startDate;
     TerminationDate   = depositFpML.maturityDate;
     DayCountFraction  = new DayCountFraction {
         Value = depositFpML.dayCountFraction.Value
     };
     BasePartyPayingFixed = !IsBasePartyLender(baseParty, depositFpML);
     if (BasePartyPayingFixed)//From the viewpoint of the counterparty!
     {
         BaseParty    = depositFpML.receiverPartyReference.href;
         CounterParty = depositFpML.payerPartyReference.href;
     }
     else
     {
         BaseParty    = depositFpML.payerPartyReference.href;
         CounterParty = depositFpML.receiverPartyReference.href;
     }
     PaymentDate      = TerminationDate;
     RiskMaturityDate = TerminationDate;
     Principal        = MoneyHelper.GetMoney(depositFpML.principal);
     Payments         = new List <PriceablePayment>();
     if (depositFpML.payment != null && depositFpML.payment.Length == 3)
     {
         //Modify to be principal and interest.
         //A principal payment ->priceable payment
         //An interest payment -> priceable fixed coupon
         var initialDate  = AdjustableOrAdjustedDateHelper.Create(null, EffectiveDate, null);
         var maturityDate = AdjustableOrAdjustedDateHelper.Create(null, PaymentDate, null);
         depositFpML.payment[0].paymentDate = initialDate;
         depositFpML.payment[1].paymentDate = maturityDate;
         depositFpML.payment[2].paymentDate = maturityDate;//Remove this and replace with depositFpML.interest
         Payments.AddRange(PriceableInstrumentsFactory.CreatePriceablePayments(BaseParty, depositFpML.payment, null));
         AddCashFlow(depositFpML, BasePartyPayingFixed);
     }
     else//This will change the input FpML as well!
     {
         var initial = PaymentHelper.Create(depositFpML.payerPartyReference.href, depositFpML.receiverPartyReference.href, Principal.currency.Value, Principal.amount, EffectiveDate);
         Payments.Add(PriceableInstrumentsFactory.CreatePriceablePayment(BaseParty, initial, null));
         var final = PaymentHelper.Create(depositFpML.receiverPartyReference.href, depositFpML.payerPartyReference.href, depositFpML.principal.currency.Value, Principal.amount, TerminationDate);
         Payments.Add(PriceableInstrumentsFactory.CreatePriceablePayment(BaseParty, final, null));
         //Payments.Add(PaymentHelper.Create("interest payment");
         AddCashFlow(depositFpML, !BasePartyPayingFixed);
     }
     //Set the product type.
     ProductType       = ProductTypeSimpleEnum.TermDeposit;
     Currency          = depositFpML.principal.currency;
     PaymentCurrencies = new List <string> {
         Currency.Value
     };
     //Set the default discount curve name.
     DiscountCurveName = CurveNameHelpers.GetDiscountCurveName(Currency.Value, true);
 }
示例#2
0
        /// <summary>
        /// Builds this instance.
        /// </summary>
        /// <returns></returns>
        public Payment Build()
        {
            var px = PaymentHelper.Create(PayerPartyReference.href, ReceiverPartyReference.href, PaymentAmount.currency.Value, Math.Abs(PaymentAmount.amount), PaymentDate);

            px.id = Id;
            //px.paymentAmount = PaymentAmount;//this is the raw amount without the multiplier effect.
            px.paymentDate = AdjustableOrAdjustedDateHelper.CreateAdjustedDate(AdjustedPaymentDate.Value, PaymentDateAdjustments);
            if (CalculationPerformedIndicator)
            {
                var payment = Math.Abs(ForecastAmount.amount);
                px.paymentAmount = MoneyHelper.GetNonNegativeAmount(payment, ForecastAmount.currency.Value);
                var npv   = Math.Abs(NPV.amount);
                var money = MoneyHelper.GetAmount(npv, PaymentAmount.currency.Value);
                px.discountFactor          = PaymentDiscountFactor;
                px.discountFactorSpecified = true;
                px.presentValueAmount      = money;
            }
            return(px);
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="logger"></param>
        /// <param name="cache"></param>
        /// <param name="nameSpace"></param>
        /// <param name="tradeDate"></param>
        /// <param name="effectiveDate"></param>
        /// <param name="referenceEquity"></param>
        /// <param name="settlementCalendar"></param>
        /// <param name="equityFpML"></param>
        /// <param name="basePartyReference"></param>
        /// <param name="forecastRateInterpolation"></param>
        public EquityTransactionPricer(ILogger logger, ICoreCache cache, string nameSpace, DateTime tradeDate, DateTime effectiveDate,
                                       String referenceEquity, IBusinessCalendar settlementCalendar, EquityTransaction equityFpML, string basePartyReference, Boolean forecastRateInterpolation)
        {
            logger.LogInfo("EquityType set. Commence to build a equity transaction.");
            if (equityFpML == null)
            {
                return;
            }
            SettlementDate    = effectiveDate;
            TradeDate         = tradeDate;
            Multiplier        = 1.0m;
            BuyerReference    = equityFpML.buyerPartyReference.href;
            PaymentCurrencies = new List <string> {
                equityFpML.unitPrice.currency.Value
            };
            SellerReference           = equityFpML.sellerPartyReference.href;
            BasePartyBuyer            = basePartyReference == equityFpML.buyerPartyReference.href;
            ForecastRateInterpolation = forecastRateInterpolation;
            SettlementCalendar        = settlementCalendar;
            ReferenceEquity           = referenceEquity;
            NumberOfShares            = Convert.ToInt16(equityFpML.numberOfUnits);
            PurchasePrice             = MoneyHelper.GetAmount(equityFpML.unitPrice.amount, equityFpML.unitPrice.currency.Value);
            PaymentCurrencies         = new List <string> {
                equityFpML.unitPrice.currency.Value
            };
            var exchangeMIC     = equityFpML.equity.exchangeId;
            var exchangeMICData = InstrumentDataHelper.CreateEquityExchangeKey(nameSpace, exchangeMIC.Value);
            var exchangeData    = cache.LoadItem <ExchangeConfigData>(exchangeMICData);

            if (exchangeData?.Data is ExchangeConfigData)
            {
                var exchange       = (ExchangeConfigData)exchangeData.Data;
                var equityTypeInfo = new EquityNodeStruct {
                    SettlementDate = exchange.SettlementDate
                };
                if (equityFpML.equity != null)
                {
                    if (SettlementCalendar == null)
                    {
                        SettlementCalendar = BusinessCenterHelper.ToBusinessCalendar(cache,
                                                                                     equityTypeInfo.SettlementDate
                                                                                     .businessCenters,
                                                                                     nameSpace);
                    }
                    if (PaymentCalendar == null)
                    {
                        PaymentCalendar = SettlementCalendar;
                    }
                    var equity = XmlSerializerHelper.Clone(equityFpML.equity);
                    EquityTypeInfo        = XmlSerializerHelper.Clone(equityTypeInfo);
                    EquityTypeInfo.Equity = equity;;
                    RiskMaturityDate      = SettlementDate;
                    MaturityDate          = SettlementDate;
                    if (!PaymentCurrencies.Contains(equityFpML.equity.currency.Value))
                    {
                        PaymentCurrencies.Add(equityFpML.equity.currency.Value);
                    }
                    logger.LogInfo("Equity transaction has been successfully created.");
                }
            }
            else
            {
                logger.LogInfo("Equity type data not available.");
            }
            //Add payments like the settlement price
            if (PurchasePrice == null || !PurchasePrice.amountSpecified)
            {
                return;
            }
            var amount            = PurchasePrice.amount * NumberOfShares;
            var settlementPayment = PaymentHelper.Create("EquitySettlemetAmount", BuyerReference, SellerReference, amount, SettlementDate);

            AdditionalPayments = PriceableInstrumentsFactory.CreatePriceablePayments(basePartyReference, new[] { settlementPayment }, PaymentCalendar);
            if (!PaymentCurrencies.Contains(settlementPayment.paymentAmount.currency.Value))
            {
                PaymentCurrencies.Add(settlementPayment.paymentAmount.currency.Value);
            }
        }
示例#4
0
        public FutureTransactionPricer(ILogger logger, ICoreCache cache, string nameSpace, DateTime tradeDate, ExchangeContractTypeEnum futuresType,
                                       IBusinessCalendar settlementCalendar, FutureTransaction futureFpML, string basePartyReference, Boolean forecastRateInterpolation)
        {
            logger.LogInfo("FuturesType set. Commence to build a future transaction.");
            if (futureFpML == null)
            {
                return;
            }
            Multiplier        = 1.0m;
            BuyerReference    = futureFpML.buyerPartyReference.href;
            PaymentCurrencies = new List <string> {
                futureFpML.unitPrice.currency.Value
            };
            SellerReference = futureFpML.sellerPartyReference.href;
            BasePartyBuyer  = basePartyReference == futureFpML.buyerPartyReference.href;
            if (!BasePartyBuyer)
            {
                Multiplier = -1.0m;
            }
            ForecastRateInterpolation = forecastRateInterpolation;
            SettlementCalendar        = settlementCalendar;
            FuturesType       = futuresType;
            ReferenceContract = futureFpML.future.id;
            var futuresCode = ReferenceContract.Split('-')[2];

            NumberOfContracts = Convert.ToInt16(futureFpML.numberOfUnits);
            PurchasePrice     = MoneyHelper.GetAmount(futureFpML.unitPrice.amount, futureFpML.unitPrice.currency.Value);
            var exchangeMIC = futureFpML.future.exchangeId;

            FuturesCurveName  = CurveNameHelpers.GetExchangeTradedCurveName(futureFpML.unitPrice.currency.Value, exchangeMIC.Value, futuresCode);
            DiscountCurveName = CurveNameHelpers.GetDiscountCurveName(futureFpML.unitPrice.currency, true);
            FuturesTypeInfo   = new FutureNodeStruct();
            var exchangeMICData = InstrumentDataHelper.CreateEquityExchangeKey(nameSpace, exchangeMIC.Value);
            var exchangeData    = cache.LoadItem <ExchangeConfigData>(exchangeMICData);

            if (exchangeData?.Data is ExchangeConfigData)
            {
                Exchange = (ExchangeConfigData)exchangeData.Data;
                FuturesTypeInfo.SpotDate = Exchange.SettlementDate;
            }
            if (futureFpML.future != null)
            {
                if (SettlementCalendar == null)
                {
                    SettlementCalendar = BusinessCenterHelper.ToBusinessCalendar(cache,
                                                                                 FuturesTypeInfo.SpotDate
                                                                                 .businessCenters,
                                                                                 nameSpace);
                }
                var future = XmlSerializerHelper.Clone(futureFpML.future);
                FuturesTypeInfo.Future = future;
                if (FuturesTypeInfo.SpotDate != null)
                {
                    SettlementDate = GetSettlementDate(tradeDate, SettlementCalendar,
                                                       FuturesTypeInfo.SpotDate);
                }
                //Instantiate the priceable future.
                NamedValueSet namedValueSet = PriceableAssetFactory.BuildPropertiesForAssets(nameSpace, FuturesTypeInfo.Future.id, tradeDate);
                var           asset         = AssetHelper.Parse(FuturesTypeInfo.Future.id, 0.0m, 0.0m);
                UnderlyingFuture = PriceableAssetFactory.Create(logger, cache, nameSpace, asset.Second, namedValueSet, null, null) as IPriceableFuturesAssetController;
                if (UnderlyingFuture != null)
                {
                    RiskMaturityDate = UnderlyingFuture.GetRiskMaturityDate();
                    MaturityDate     = RiskMaturityDate;
                    LastTradeDate    = UnderlyingFuture.LastTradeDate;
                }
                if (!PaymentCurrencies.Contains(futureFpML.future.currency.Value))
                {
                    PaymentCurrencies.Add(futureFpML.future.currency.Value);
                }
                logger.LogInfo("Futures transaction has been successfully created.");
            }
            else
            {
                logger.LogInfo("Futures type data not available.");
            }
            //Add payments like the settlement price
            if (!PurchasePrice.amountSpecified)
            {
                return;
            }
            var amount            = PurchasePrice.amount * NumberOfContracts / 100;
            var settlementPayment = PaymentHelper.Create("FuturesSettlemetAmount", BuyerReference, SellerReference, amount, SettlementDate);

            AdditionalPayments = PriceableInstrumentsFactory.CreatePriceablePayments(basePartyReference, new[] { settlementPayment }, SettlementCalendar);
            if (!PaymentCurrencies.Contains(settlementPayment.paymentAmount.currency.Value))
            {
                PaymentCurrencies.Add(settlementPayment.paymentAmount.currency.Value);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="logger"></param>
        /// <param name="cache"></param>
        /// <param name="nameSpace"></param>
        /// <param name="tradeDate"></param>
        /// <param name="settlementDate">The payment settlement date.</param>
        /// <param name="settlementCalendar"></param>
        /// <param name="paymentCalendar"></param>
        /// <param name="bondFpML"></param>
        /// <param name="basePartyReference"></param>
        /// <param name="bondType"></param>
        /// <param name="forecastRateInterpolation"></param>
        public BondTransactionPricer(ILogger logger, ICoreCache cache, string nameSpace, DateTime tradeDate,
                                     DateTime settlementDate, IBusinessCalendar settlementCalendar, IBusinessCalendar paymentCalendar,
                                     BondTransaction bondFpML, string basePartyReference, string bondType, Boolean forecastRateInterpolation)
        {
            Multiplier = 1.0m;
            TradeDate  = tradeDate;
            BondType   = EnumHelper.Parse <BondTypesEnum>(bondType);
            logger.LogInfo("BondType set. Commence to build a bond transaction.");
            if (bondFpML == null)
            {
                return;
            }
            BuyerReference    = bondFpML.buyerPartyReference.href;
            PaymentCurrencies = new List <string> {
                bondFpML.notionalAmount.currency.Value
            };
            SellerReference = bondFpML.sellerPartyReference.href;
            BasePartyBuyer  = basePartyReference == bondFpML.buyerPartyReference.href;
            if (!BasePartyBuyer)
            {
                Multiplier = -1.0m;
            }
            ForecastRateInterpolation = forecastRateInterpolation;
            SettlementCalendar        = settlementCalendar;
            PaymentCalendar           = paymentCalendar;
            //Set the bond price information
            BondPrice = new BondPrice();
            if (bondFpML.price.accrualsSpecified)
            {
                BondPrice.accrualsSpecified = true;
                BondPrice.accruals          = bondFpML.price.accruals;
            }
            if (bondFpML.price.dirtyPriceSpecified)
            {
                BondPrice.dirtyPriceSpecified = true;
                BondPrice.dirtyPrice          = bondFpML.price.dirtyPrice;
            }
            BondPrice.cleanOfAccruedInterest = bondFpML.price.cleanOfAccruedInterest;
            BondPrice.cleanPrice             = bondFpML.price.cleanPrice;
            //Set the notional information
            NotionalAmount = MoneyHelper.GetAmount(bondFpML.notionalAmount.amount, bondFpML.notionalAmount.currency.Value);
            //Determines the quotation and units
            QuoteType = BondPriceEnum.YieldToMaturity;
            //We need to get the ytm in until there is a bond market price/spread.
            if (BondPrice.dirtyPriceSpecified)
            {
                QuoteType = BondPriceEnum.DirtyPrice;
                Quote     = BasicQuotationHelper.Create(BondPrice.dirtyPrice, RateQuotationType);
            }
            //Get the insturment configuration information.
            var            assetIdentifier = bondFpML.bond.currency.Value + "-Bond-" + BondType;
            BondNodeStruct bondTypeInfo    = null;
            var            instrument      = InstrumentDataHelper.GetInstrumentConfigurationData(cache, nameSpace, assetIdentifier);

            if (instrument != null)
            {
                bondTypeInfo = instrument.InstrumentNodeItem as BondNodeStruct;
            }
            if (bondFpML.bond != null && bondTypeInfo != null)
            {
                if (SettlementCalendar == null)
                {
                    SettlementCalendar = BusinessCenterHelper.ToBusinessCalendar(cache, bondTypeInfo.SettlementDate.businessCenters, nameSpace);
                }
                if (PaymentCalendar == null)
                {
                    PaymentCalendar = BusinessCenterHelper.ToBusinessCalendar(cache, bondTypeInfo.BusinessDayAdjustments.businessCenters, nameSpace);
                }
                //Preprocesses the data for the priceableasset.
                var bond = XmlSerializerHelper.Clone(bondFpML.bond);
                BondTypeInfo      = XmlSerializerHelper.Clone(bondTypeInfo);
                BondTypeInfo.Bond = bond;
                //This is done because the config data is not stored in the ciorrect way. Need to add a price quote units.
                if (bond.couponRateSpecified)
                {
                    var coupon = bond.couponRate;
                    BondTypeInfo.Bond.couponRate = coupon;
                }
                BondTypeInfo.Bond.faceAmount = NotionalAmount.amount;
                if (BondTypeInfo.Bond.maturitySpecified)
                {
                    RiskMaturityDate = BondTypeInfo.Bond.maturity;
                }
                SettlementDate = settlementDate;
                if (!PaymentCurrencies.Contains(bondFpML.bond.currency.Value))
                {
                    PaymentCurrencies.Add(bondFpML.bond.currency.Value);
                }
                logger.LogInfo("Bond transaction has been successfully created.");
            }
            else
            {
                logger.LogInfo("Bond type data not available.");
            }
            //Add payments like the settlement price
            if (!BondPrice.dirtyPriceSpecified)
            {
                return;
            }
            var amount            = BondPrice.dirtyPrice * NotionalAmount.amount / 100;
            var settlementPayment = PaymentHelper.Create("BondSettlemetAmount", BuyerReference, SellerReference, amount, SettlementDate);

            AdditionalPayments = PriceableInstrumentsFactory.CreatePriceablePayments(basePartyReference, new[] { settlementPayment }, SettlementCalendar);
            if (!PaymentCurrencies.Contains(settlementPayment.paymentAmount.currency.Value))
            {
                PaymentCurrencies.Add(settlementPayment.paymentAmount.currency.Value);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="logger"></param>
        /// <param name="cache"></param>
        /// <param name="nameSpace"></param>
        /// <param name="tradeDate"></param>
        /// <param name="settlementDate">The payment settlement date.</param>
        /// <param name="settlementCalendar"></param>
        /// <param name="paymentCalendar"></param>
        /// <param name="bondFpML"></param>
        /// <param name="basePartyReference"></param>
        /// <param name="bondType"></param>
        /// <param name="forecastRateInterpolation"></param>
        public BondTransactionPricer(ILogger logger, ICoreCache cache, string nameSpace, DateTime tradeDate,
                                     DateTime settlementDate, IBusinessCalendar settlementCalendar, IBusinessCalendar paymentCalendar,
                                     BondTransaction bondFpML, string basePartyReference, string bondType, bool forecastRateInterpolation)
        {
            Multiplier = 1.0m;
            TradeDate  = tradeDate;
            BondType   = EnumHelper.Parse <BondTypesEnum>(bondType);
            logger.LogInfo("BondType set. Commence to build a bond transaction.");
            if (bondFpML == null)
            {
                return;
            }
            BuyerReference    = bondFpML.buyerPartyReference.href;
            PaymentCurrencies = new List <string> {
                bondFpML.notionalAmount.currency.Value
            };
            SellerReference = bondFpML.sellerPartyReference.href;
            BasePartyBuyer  = basePartyReference == bondFpML.buyerPartyReference.href;
            if (!BasePartyBuyer)
            {
                Multiplier = -1.0m;
            }
            ForecastRateInterpolation = forecastRateInterpolation;
            SettlementCalendar        = settlementCalendar;
            PaymentCalendar           = paymentCalendar;
            //Set the bond price information
            BondPrice = new BondPrice();
            if (bondFpML.price.accrualsSpecified)
            {
                BondPrice.accrualsSpecified = true;
                BondPrice.accruals          = bondFpML.price.accruals;
            }
            if (bondFpML.price.dirtyPriceSpecified)
            {
                BondPrice.dirtyPriceSpecified = true;
                BondPrice.dirtyPrice          = bondFpML.price.dirtyPrice;
            }
            BondPrice.cleanOfAccruedInterest = bondFpML.price.cleanOfAccruedInterest;
            BondPrice.cleanPrice             = bondFpML.price.cleanPrice;
            //Set the currencies
            CouponCurrency  = bondFpML.notionalAmount.currency;
            PaymentCurrency = bondFpML.notionalAmount.currency;//This could be another currency!
            //Set the notional information
            NotionalAmount = MoneyHelper.GetAmount(bondFpML.notionalAmount.amount, bondFpML.notionalAmount.currency.Value);
            //Determines the quotation and units
            QuoteType = BondPriceEnum.YieldToMaturity;
            //We need to get the ytm in until there is a bond market price/spread.
            if (BondPrice.dirtyPriceSpecified)
            {
                QuoteType = BondPriceEnum.DirtyPrice;
                Quote     = BasicQuotationHelper.Create(BondPrice.dirtyPrice, RateQuotationType);
            }
            //Get the instrument configuration information.
            var            assetIdentifier = bondFpML.bond.currency.Value + "-Bond-" + BondType;
            BondNodeStruct bondTypeInfo    = null;
            //TODO Set the swap curves for asset swap valuation.
            //
            //Gets the template bond type
            var instrument = InstrumentDataHelper.GetInstrumentConfigurationData(cache, nameSpace, assetIdentifier);

            if (instrument != null)
            {
                bondTypeInfo = instrument.InstrumentNodeItem as BondNodeStruct;
            }
            if (bondFpML.bond != null && bondTypeInfo != null)
            {
                if (SettlementCalendar == null)
                {
                    SettlementCalendar = BusinessCenterHelper.ToBusinessCalendar(cache, bondTypeInfo.SettlementDate.businessCenters, nameSpace);
                }
                if (PaymentCalendar == null)
                {
                    PaymentCalendar = BusinessCenterHelper.ToBusinessCalendar(cache, bondTypeInfo.BusinessDayAdjustments.businessCenters, nameSpace);
                }
                //Pre-processes the data for the priceable asset.
                var bond = XmlSerializerHelper.Clone(bondFpML.bond);
                Bond = bond;
                bondTypeInfo.Bond = Bond;
                //Set the curves to use for valuations.
                BondCurveName = CurveNameHelpers.GetBondCurveName(Bond.currency.Value, Bond.id);
                //THe discount curve is only for credit calculations.
                DiscountCurveName = CurveNameHelpers.GetDiscountCurveName(Bond.currency.Value, true);
                if (bond.maturitySpecified)
                {
                    MaturityDate = bond.maturity;
                }
                SettlementDateConvention = bondTypeInfo.SettlementDate;
                BusinessDayAdjustments   = bondTypeInfo.BusinessDayAdjustments;
                ExDivDateConvention      = bondTypeInfo.ExDivDate;
                //This is done because the config data is not stored in the correct way. Need to add a price quote units.
                if (bond.couponRateSpecified)
                {
                    var coupon = bond.couponRate;
                    Bond.couponRate = coupon;
                }
                bondTypeInfo.Bond.faceAmount          = NotionalAmount.amount;
                bondTypeInfo.Bond.faceAmountSpecified = true;
                Bond.faceAmount = NotionalAmount.amount;
                if (Bond.maturitySpecified)
                {
                    RiskMaturityDate = Bond.maturity;
                }
                SettlementDate = settlementDate;
                if (!PaymentCurrencies.Contains(bondFpML.bond.currency.Value))
                {
                    PaymentCurrencies.Add(bondFpML.bond.currency.Value);
                }
                logger.LogInfo("Bond transaction has been successfully created.");
            }
            else
            {
                logger.LogInfo("Bond type data not available.");
            }
            //Set the underlying bond
            UnderlyingBond = new PriceableSimpleBond(tradeDate, bondTypeInfo, SettlementCalendar, PaymentCalendar, Quote, QuoteType);
            BondIssuer     = UnderlyingBond.Issuer;
            if (BondPrice.dirtyPriceSpecified)
            {
                UnderlyingBond.PurchasePrice = BondPrice.dirtyPrice / 100; //PriceQuoteUnits
            }
            //Set the coupons
            var bondId = Bond.id;//Could use one of the instrumentIds

            //bondStream is an interest Rate Stream but needs to be converted to a bond stream.
            //It automatically contains the coupon currency.
            Coupons = new PriceableBondCouponRateStream(logger, cache, nameSpace, bondId, tradeDate,
                                                        bondFpML.notionalAmount.amount, CouponStreamType.GenericFixedRate, Bond,
                                                        BusinessDayAdjustments, ForecastRateInterpolation, null, PaymentCalendar);
            //Add payments like the settlement price
            if (!BondPrice.dirtyPriceSpecified)
            {
                return;
            }
            var amount            = BondPrice.dirtyPrice * NotionalAmount.amount / 100;
            var settlementPayment = PaymentHelper.Create(BuyerReference, SellerReference, PaymentCurrency.Value, amount, SettlementDate);

            AdditionalPayments = PriceableInstrumentsFactory.CreatePriceablePayments(basePartyReference, new[] { settlementPayment }, SettlementCalendar);
            //
            var finalPayment = PaymentHelper.Create(BondIssuer, BuyerReference, CouponCurrency.Value, NotionalAmount.amount, RiskMaturityDate);

            FinalRedemption =
                PriceableInstrumentsFactory.CreatePriceablePayment(basePartyReference, finalPayment, PaymentCalendar);
            AdditionalPayments.Add(FinalRedemption);
            if (!PaymentCurrencies.Contains(settlementPayment.paymentAmount.currency.Value))
            {
                PaymentCurrencies.Add(settlementPayment.paymentAmount.currency.Value);
            }
        }