Exemple #1
0
        public static Notional Create(Money initialValue)
        {
            var result = new Notional {
                notionalStepSchedule = new NonNegativeAmountSchedule
                {
                    initialValue          = initialValue.amount,
                    initialValueSpecified = true,
                    currency = initialValue.currency
                }
            };

            return(result);
        }
        public static Decimal  GetNotionalValue(Notional notional, DateTime dateTime)
        {
            if (null == notional.notionalStepSchedule.step)
            {
                return(notional.notionalStepSchedule.initialValue);
            }
            else
            {
                // I assume that the dates in a step schedule are in the ascensing order.
                //
                NonNegativeAmountSchedule notionalStepSchedule = notional.notionalStepSchedule;

                ArrayList listOfStepDates  = new ArrayList();
                ArrayList listOfStepValues = new ArrayList();

                foreach (var step in notionalStepSchedule.step)
                {
                    listOfStepDates.Add(step.stepDate);
                    listOfStepValues.Add(step.stepValue);
                }

                int foundAtIndex = listOfStepDates.BinarySearch(dateTime);

                if (foundAtIndex < 0)
                {
                    int indexOfLargeDate = ~foundAtIndex;

                    if (0 == indexOfLargeDate)
                    {
                        return(notional.notionalStepSchedule.initialValue);
                    }
                    else
                    {
                        decimal val = (decimal)listOfStepValues[indexOfLargeDate - 1];

                        return(val);
                    }
                }
                else
                {
                    return((decimal)listOfStepValues[foundAtIndex]);
                }
            }
        }
Exemple #3
0
        private static Notional ReadNotional(EntryObject o)
        {
            foreach (String property in s_Properties.Except(s_PropertiesAmount.Union(s_PropertiesCommon).Union(s_PropertiesTrade).Union(s_PropertiesModel)))
            {
                if (!String.IsNullOrEmpty((String)o.GetType().GetProperty(property)?.GetValue(o)))
                {
                    throw new InvalidDataException($"The CRIF file cannot specify the {property} property for Notional entries.");
                }
            }

            if (!Enum.TryParse(o.ProductClass, out Schedule.Product product))
            {
                throw new InvalidDataException("The CRIF file contains a Notional entry with an invalid ProductClass property.");
            }

            Amount          amount          = ReadAmount(o);
            RegulationsInfo regulationsInfo = ReadRegulationsInfo(o);
            TradeInfo       tradeInfo       = ReadTradeInfo(o);

            return(Notional.OfUnchecked(product, amount, regulationsInfo, tradeInfo));
        }
 private void SyncViewWithModel()
 {
     AddDisposable(_router.GetModelObservable().Observe(model =>
     {
         using (_entryMonitor.Enter())
         {
             Log.DebugFormat("Model update received. Version: {0}", model.Version);
             QuoteId      = model.Rfq.QuoteId;
             OrderSummary = model.Inputs.OrderSummary;
             RfqSummary   = model.Rfq.RfqSummary;
             Notional.Sync(model.Inputs.Notional);
             CurrencyPair.Sync(model.Inputs.CurrencyPair);
             Status = model.Rfq.Status;
             Rate   = model.Rfq.Rate;
             RequestQuote.RaiseCanExecuteChanged();
             AcceptQuoteCommand.RaiseCanExecuteChanged();
             RejectQuoteCommand.RaiseCanExecuteChanged();
             IsRequestQuoteButtonVisible = !model.Rfq.Status.RfqInFlight();
             QuotingButtonsVisible       = model.Rfq.Status == QuoteStatus.Quoting;
         }
     }));
 }
 private void ObserveChanges()
 {
     RequestQuote = new DelegateCommand(
         _ => _router.PublishEvent(new RequestQuoteEvent()),
         _ => Notional.HasValue && CurrencyPair.HasValue && _status != QuoteStatus.Quoting
         );
     AcceptQuoteCommand = new DelegateCommand(
         _ => _router.PublishEvent(new AcceptQuoteEvent(_quoteId)),
         _ => _status == QuoteStatus.Quoting
         );
     RejectQuoteCommand = new DelegateCommand(
         _ => _router.PublishEvent(new RejectQuoteEvent(_quoteId)),
         _ => _status == QuoteStatus.Quoting
         );
     Notional
     .ObserveProperty(q => q.Value)
     .Where(_ => !_entryMonitor.IsBusy)
     .Subscribe(quantity => _router.PublishEvent(new NotionalChangedEvent(quantity)));
     CurrencyPair
     .ObserveProperty(q => q.Value)
     .Where(_ => !_entryMonitor.IsBusy)
     .Subscribe(symbol => _router.PublishEvent(new CurrencyPairChangedEvent(symbol)));
 }
 public static void CalculationSetNotionalSchedule(Calculation calculation, Notional value)
 {
     calculation.Items = new object[] { value };
 }
Exemple #7
0
        private static void CalculateForecastPaymentAmount(Calculation calculation,
                                                           FloatingRateCalculation floatingRateCalculation,
                                                           PaymentCalculationPeriod paymentCalculationPeriod,
                                                           IRateCurve forecastCurve,
                                                           IRateCurve discountCurve,
                                                           DateTime valuationDate)
        {
            var      amountAccruedPerPaymentPeriod = new List <Money>();
            decimal  interestFromPreviousPeriods   = 0;
            Notional notionalSchedule = XsdClassesFieldResolver.CalculationGetNotionalSchedule(calculation);
            Currency notionalCurrency = notionalSchedule.notionalStepSchedule.currency;

            //  Cashflows
            //
            foreach (CalculationPeriod calculationPeriod in XsdClassesFieldResolver.GetPaymentCalculationPeriodCalculationPeriodArray(paymentCalculationPeriod))
            {
                decimal notional  = XsdClassesFieldResolver.CalculationPeriodGetNotionalAmount(calculationPeriod);
                decimal finalRate = 0.0m;
                //  If has a fixed rate (fixed rate coupon)
                //
                if (XsdClassesFieldResolver.CalculationPeriodHasFixedRate(calculationPeriod))
                {
                    finalRate = XsdClassesFieldResolver.CalculationPeriodGetFixedRate(calculationPeriod);
                }
                else if (XsdClassesFieldResolver.CalculationPeriodHasFloatingRateDefinition(calculationPeriod))
                {
                    if (null != forecastCurve)
                    {
                        FloatingRateDefinition floatingRateDefinition = XsdClassesFieldResolver.CalculationPeriodGetFloatingRateDefinition(calculationPeriod);
                        // Apply spread from schedule if it hasn't been specified yet.
                        //
                        if (!floatingRateDefinition.spreadSpecified)
                        {
                            floatingRateDefinition.spread          = floatingRateCalculation.spreadSchedule[0].initialValue;
                            floatingRateDefinition.spreadSpecified = true;
                        }
                        ForecastRateHelper.UpdateFloatingRateDefinition(floatingRateDefinition, floatingRateCalculation,
                                                                        calculation.dayCountFraction,
                                                                        calculationPeriod,
                                                                        forecastCurve);
                        calculationPeriod.Item1 = floatingRateDefinition;
                        decimal calculatedRate = floatingRateDefinition.calculatedRate;
                        //  final rate after application of Cap/Floor  rates
                        //
                        finalRate = calculatedRate;
                        //  If has a Cap rate, finalRate = MAX(0, FinalRate - CapRate)
                        //
                        if (null != floatingRateDefinition.capRate)
                        {
                            Strike strike = floatingRateDefinition.capRate[0];
                            finalRate = System.Math.Max(0, finalRate - strike.strikeRate);
                        }
                        //  If has a Floor rate, finalRate = MAX(0, FloorRate - FinalRate)
                        //
                        if (null != floatingRateDefinition.floorRate)
                        {
                            Strike strike = floatingRateDefinition.floorRate[0];
                            finalRate = System.Math.Max(0, strike.strikeRate - finalRate);
                        }
                    }
                }
                else
                {
                    throw new System.Exception("CalculationPeriod has neither fixedRate nor floatngRateDefinition.");
                }
                // Compound interest accrued during previos calculation periods in this payment period.
                //
                decimal notionalAdjustedForInterestFromPreviousPeriods = notional + interestFromPreviousPeriods;
                if (calculation.discounting == null)
                {
                    interestFromPreviousPeriods = notionalAdjustedForInterestFromPreviousPeriods * finalRate * calculationPeriod.dayCountYearFraction;
                }
                else if (calculation.discounting.discountingType == DiscountingTypeEnum.FRA || calculation.discounting.discountingType == DiscountingTypeEnum.Standard)
                {
                    interestFromPreviousPeriods = notionalAdjustedForInterestFromPreviousPeriods * (1.0m - 1.0m / (1.0m + finalRate * calculationPeriod.dayCountYearFraction));
                }
                else
                {
                    throw new NotSupportedException("The specified discountingType is not supported.");
                }
                Money amountAccruedPerCalculationPeriod = MoneyHelper.GetAmount(interestFromPreviousPeriods, notionalCurrency);
                amountAccruedPerPaymentPeriod.Add(amountAccruedPerCalculationPeriod);
            }
            paymentCalculationPeriod.forecastPaymentAmount   = MoneyHelper.Sum(amountAccruedPerPaymentPeriod);
            paymentCalculationPeriod.discountFactor          = (decimal)discountCurve.GetDiscountFactor(valuationDate, paymentCalculationPeriod.adjustedPaymentDate);
            paymentCalculationPeriod.discountFactorSpecified = true;
            paymentCalculationPeriod.presentValueAmount      = MoneyHelper.Mul(paymentCalculationPeriod.forecastPaymentAmount, paymentCalculationPeriod.discountFactor);
        }
 public static void CalculationSetNotionalSchedule(Calculation calculation, Notional value)
 {
     calculation.Item = value;
 }
 void ReleaseDesignerOutlets()
 {
     if (Activity != null)
     {
         Activity.Dispose();
         Activity = null;
     }
     if (CurrencyPair != null)
     {
         CurrencyPair.Dispose();
         CurrencyPair = null;
     }
     if (Executing != null)
     {
         Executing.Dispose();
         Executing = null;
     }
     if (LeftSideAction != null)
     {
         LeftSideAction.Dispose();
         LeftSideAction = null;
     }
     if (LeftSideBigNumber != null)
     {
         LeftSideBigNumber.Dispose();
         LeftSideBigNumber = null;
     }
     if (LeftSideButton != null)
     {
         LeftSideButton.Dispose();
         LeftSideButton = null;
     }
     if (LeftSideNumber != null)
     {
         LeftSideNumber.Dispose();
         LeftSideNumber = null;
     }
     if (LeftSidePips != null)
     {
         LeftSidePips.Dispose();
         LeftSidePips = null;
     }
     if (Notional != null)
     {
         Notional.Dispose();
         Notional = null;
     }
     if (NotionalCCY != null)
     {
         NotionalCCY.Dispose();
         NotionalCCY = null;
     }
     if (PriceMovementDown != null)
     {
         PriceMovementDown.Dispose();
         PriceMovementDown = null;
     }
     if (PriceMovementUp != null)
     {
         PriceMovementUp.Dispose();
         PriceMovementUp = null;
     }
     if (RightSideAction != null)
     {
         RightSideAction.Dispose();
         RightSideAction = null;
     }
     if (RightSideBigNumber != null)
     {
         RightSideBigNumber.Dispose();
         RightSideBigNumber = null;
     }
     if (RightSideButton != null)
     {
         RightSideButton.Dispose();
         RightSideButton = null;
     }
     if (RightSideNumber != null)
     {
         RightSideNumber.Dispose();
         RightSideNumber = null;
     }
     if (RightSidePips != null)
     {
         RightSidePips.Dispose();
         RightSidePips = null;
     }
     if (SpotDate != null)
     {
         SpotDate.Dispose();
         SpotDate = null;
     }
     if (Spread != null)
     {
         Spread.Dispose();
         Spread = null;
     }
 }
        private static void UpdateCalculationPeriodData(Calculation calculation, CalculationPeriod calculationPeriod, Notional notinalSchedule)
        {
            bool hasFloatingRateCalculation = XsdClassesFieldResolver.CalculationHasFloatingRateCalculation(calculation);
            bool hasFixedRate = XsdClassesFieldResolver.CalculationHasFixedRateSchedule(calculation);

            if (!(hasFloatingRateCalculation ^ hasFixedRate))
            {
                throw new System.Exception("at least one type of rate (floating or fixed) must be specified.");
            }
            decimal notional = NotionalHelper.GetNotionalValue(notinalSchedule, calculationPeriod.adjustedStartDate);

            // Notional amount
            //
            XsdClassesFieldResolver.CalculationPeriodSetNotionalAmount(calculationPeriod, notional);
            // Fixed rate
            //
            if (hasFixedRate)
            {
                Schedule fixedRateSchedule = XsdClassesFieldResolver.CalculationGetFixedRateSchedule(calculation);
                decimal  fixedRate         = ScheduleHelper.GetValue(fixedRateSchedule, calculationPeriod.adjustedStartDate);
                XsdClassesFieldResolver.SetCalculationPeriodFixedRate(calculationPeriod, fixedRate);
            }
            //  Floating rate
            //
            else// if (hasFloatingRateCalculation)
            {
                // no observed, no calculated rate, spread == 0.0
                //
                var floatingRateDefinition = (FloatingRateDefinition)calculationPeriod.Item1 ?? new FloatingRateDefinition();
                //  check if stream has spreadSchedule
                //
                if (XsdClassesFieldResolver.CalculationHasSpreadSchedule(calculation))
                {
                    Schedule spreadSchedule = XsdClassesFieldResolver.GetCalculationSpreadSchedule(calculation);
                    decimal  spread         = ScheduleHelper.GetValue(spreadSchedule, calculationPeriod.adjustedStartDate);
                    floatingRateDefinition.spread          = spread;
                    floatingRateDefinition.spreadSpecified = true;
                }
                FloatingRateCalculation floatingRateCalculation = XsdClassesFieldResolver.CalculationGetFloatingRateCalculation(calculation);
                //  Check if there's a capRateSchedule
                //
                if (null != floatingRateCalculation.capRateSchedule)
                {
                    StrikeSchedule capRateSchedule = floatingRateCalculation.capRateSchedule[0];
                    var            capStrike       = new Strike();
                    var            capRate         = ScheduleHelper.GetValue(capRateSchedule, calculationPeriod.adjustedStartDate);
                    capStrike.strikeRate           = capRate;
                    floatingRateDefinition.capRate = new[] { capStrike };
                }
                //  Check if there's a capRateSchedule
                //
                if (null != floatingRateCalculation.floorRateSchedule)
                {
                    StrikeSchedule floorRateSchedule = floatingRateCalculation.floorRateSchedule[0];
                    var            floorStrike       = new Strike();
                    decimal        floorRate         = ScheduleHelper.GetValue(floorRateSchedule, calculationPeriod.adjustedStartDate);
                    floorStrike.strikeRate           = floorRate;
                    floatingRateDefinition.floorRate = new[] { floorStrike };
                }
                calculationPeriod.Item1 = floatingRateDefinition;
            }
        }
        private static void UpdateStubCalculationPeriodData(InterestRateStream interestRateStream, CalculationPeriod stubCalculationPeriod, StubValue stubValue, Notional notinalSchedule)
        {
            StubCalculationPeriodAmountHelper.UpdateStubCalculationPeriod(interestRateStream, stubCalculationPeriod, stubValue);
            decimal notional = NotionalHelper.GetNotionalValue(notinalSchedule, stubCalculationPeriod.adjustedStartDate);

            // Notinal amount
            //
            XsdClassesFieldResolver.CalculationPeriodSetNotionalAmount(stubCalculationPeriod, notional);
        }
        /// <summary>
        /// Update calculation periods with rates/notional.
        /// </summary>
        /// <param name="interestRateStream"></param>
        /// <param name="calculationPeriodsPrincipalExchangesAndStubs"></param>
        public static void UpdateCalculationPeriodsData(InterestRateStream interestRateStream, CalculationPeriodsPrincipalExchangesAndStubs calculationPeriodsPrincipalExchangesAndStubs)
        {
            Calculation calculation      = XsdClassesFieldResolver.CalculationPeriodAmountGetCalculation(interestRateStream.calculationPeriodAmount);
            Notional    notionalSchedule = XsdClassesFieldResolver.CalculationGetNotionalSchedule(calculation);

            #region Generate FUTURE amounts for principle exchanges

            //  Initial PE
            //
            if (null != calculationPeriodsPrincipalExchangesAndStubs.InitialPrincipalExchange)
            {
                //  initial OUTflow
                //
                decimal initialNotionalValue = ScheduleHelper.GetValue(notionalSchedule.notionalStepSchedule, calculationPeriodsPrincipalExchangesAndStubs.InitialPrincipalExchange.adjustedPrincipalExchangeDate);
                calculationPeriodsPrincipalExchangesAndStubs.InitialPrincipalExchange.principalExchangeAmount          = -initialNotionalValue;
                calculationPeriodsPrincipalExchangesAndStubs.InitialPrincipalExchange.principalExchangeAmountSpecified = true;
            }
            //  intermediatory PE
            //
            foreach (PrincipalExchange intermediatoryExchange in calculationPeriodsPrincipalExchangesAndStubs.IntermediatePrincipalExchanges)
            {
                DateTime principleExchangeDate = intermediatoryExchange.adjustedPrincipalExchangeDate;
                //value at the day before principle exchange day
                //
                decimal prevNotionalValue = ScheduleHelper.GetValue(notionalSchedule.notionalStepSchedule, principleExchangeDate.AddDays(-1));
                //value at principle exchange day ..
                //
                decimal newNotionalValue        = ScheduleHelper.GetValue(notionalSchedule.notionalStepSchedule, principleExchangeDate);
                decimal principalExchangeAmount = prevNotionalValue - newNotionalValue;
                intermediatoryExchange.principalExchangeAmount          = principalExchangeAmount;
                intermediatoryExchange.principalExchangeAmountSpecified = true;
            }
            //  Final PE
            //
            if (null != calculationPeriodsPrincipalExchangesAndStubs.FinalPrincipalExchange)
            {
                // pay the rest ot the notional back
                //
                decimal newNotionalValue = ScheduleHelper.GetValue(notionalSchedule.notionalStepSchedule,
                                                                   calculationPeriodsPrincipalExchangesAndStubs.FinalPrincipalExchange.adjustedPrincipalExchangeDate);
                calculationPeriodsPrincipalExchangesAndStubs.FinalPrincipalExchange.principalExchangeAmount          = newNotionalValue;
                calculationPeriodsPrincipalExchangesAndStubs.FinalPrincipalExchange.principalExchangeAmountSpecified = true;
            }

            #endregion

            //  Process standard calculation periods
            //
            foreach (CalculationPeriod calculationPeriod in calculationPeriodsPrincipalExchangesAndStubs.CalculationPeriods)
            {
                UpdateCalculationPeriodData(calculation, calculationPeriod, notionalSchedule);
            }
            // Process stub calculation periods
            //
            if (null != interestRateStream.stubCalculationPeriodAmount)
            {
                if ((null == interestRateStream.stubCalculationPeriodAmount.initialStub) &&
                    (null == interestRateStream.stubCalculationPeriodAmount.finalStub))
                {
                    throw new System.Exception(
                              "interestRateStream.stubCalculationPeriodAmount.initialStub && interestRateStream.stubCalculationPeriodAmount.finalStub are null");
                }
                StubValue initialStub = interestRateStream.stubCalculationPeriodAmount.initialStub;
                StubValue finalStub   = interestRateStream.stubCalculationPeriodAmount.finalStub;
                if (null != calculationPeriodsPrincipalExchangesAndStubs.InitialStubCalculationPeriod && null != initialStub)
                {
                    UpdateStubCalculationPeriodData(interestRateStream, calculationPeriodsPrincipalExchangesAndStubs.InitialStubCalculationPeriod, initialStub, notionalSchedule);
                }
                if (null != calculationPeriodsPrincipalExchangesAndStubs.FinalStubCalculationPeriod && null != finalStub)
                {
                    UpdateStubCalculationPeriodData(interestRateStream, calculationPeriodsPrincipalExchangesAndStubs.FinalStubCalculationPeriod, finalStub, notionalSchedule);
                }
            }
            else
            {
                foreach (CalculationPeriod calculationPeriod in new[] { calculationPeriodsPrincipalExchangesAndStubs.InitialStubCalculationPeriod, calculationPeriodsPrincipalExchangesAndStubs.FinalStubCalculationPeriod })
                {
                    if (null != calculationPeriod)
                    {
                        UpdateCalculationPeriodData(calculation, calculationPeriod, notionalSchedule);
                    }
                }
            }
        }
        /// <summary>
        /// Don't generate stubs?
        /// </summary>
        /// <param name="interestRateStream"></param>
        /// <param name="rollDates">from #1st roll date to last roll date (last roll dates is effectively the end of the swap)</param>
        /// <param name="paymentCalendar"></param>
        /// <returns></returns>
        public static CalculationPeriodsPrincipalExchangesAndStubs GenerateCalculationPeriodsPrincipalExchangesAndStubsFromRollDates(InterestRateStream interestRateStream,
                                                                                                                                     List <DateTime> rollDates,
                                                                                                                                     IBusinessCalendar paymentCalendar)
        {
            CalculationPeriodDates calculationPeriodDates  = interestRateStream.calculationPeriodDates;
            AdjustableDate         adjustableEffectiveDate = XsdClassesFieldResolver.CalculationPeriodDatesGetEffectiveDate(calculationPeriodDates);
            var result = new CalculationPeriodsPrincipalExchangesAndStubs();

            for (int rollDateIndex = 0; rollDateIndex < rollDates.Count - 1; ++rollDateIndex)
            {
                DateTime startOfThePeriod  = rollDates[rollDateIndex];
                DateTime endOfThePeriod    = rollDates[rollDateIndex + 1];
                var      calculationPeriod = new CalculationPeriod();
                //  Set adjusted period dates
                //
                CalculationPeriodHelper.SetAdjustedDates(calculationPeriod,
                                                         startOfThePeriod,
                                                         endOfThePeriod);
                result.Add(calculationPeriod);
            }
            //  Add principle exchanges if this need is defined in parametric representation of the interest rate steam.
            //
            if (null != interestRateStream.principalExchanges)
            {
                //  Initial PE
                //
                if (interestRateStream.principalExchanges.initialExchange)
                {
                    //if (paymentCalendar == null)
                    //{
                    //    paymentCalendar = BusinessCenterHelper.ToBusinessCalendar(cache, adjustableEffectiveDate.dateAdjustments.businessCenters);
                    //}
                    PrincipalExchange initialExchange = PrincipalExchangeHelper.Create(AdjustedDateHelper.ToAdjustedDate(paymentCalendar, adjustableEffectiveDate));
                    result.InitialPrincipalExchange = initialExchange;
                }
                //  intermediatory PE
                //
                if (interestRateStream.principalExchanges.intermediateExchange)
                {
                    // Generate a list of intermediatory PE exchanges
                    //
                    Calculation calculation      = XsdClassesFieldResolver.CalculationPeriodAmountGetCalculation(interestRateStream.calculationPeriodAmount);
                    Notional    notionalSchedule = XsdClassesFieldResolver.CalculationGetNotionalSchedule(calculation);
                    if (null != notionalSchedule.notionalStepSchedule.step)//there should be steps - otherwise NO interm. exchanges.
                    {
                        foreach (DateTime stepDate in ScheduleHelper.GetStepDates(notionalSchedule.notionalStepSchedule))
                        {
                            PrincipalExchange intermediatoryExchange = PrincipalExchangeHelper.Create(stepDate);
                            result.Add(intermediatoryExchange);
                        }
                    }
                }
                //AdjustableDate adjustableTerminationDate = XsdClassesFieldResolver.CalculationPeriodDates_GetTerminationDate(calculationPeriodDates);
                DateTime lastRollDate = rollDates[rollDates.Count - 1];
                //  Final PE
                //
                if (interestRateStream.principalExchanges.finalExchange)
                {
                    //PrincipalExchange finalExchange = PrincipalExchangeHelper.Create(DateTypesHelper.ToAdjustedDate(adjustableTerminationDate));
                    PrincipalExchange finalExchange = PrincipalExchangeHelper.Create(lastRollDate);
                    result.FinalPrincipalExchange = finalExchange;
                }
            }
            return(result);
        }
        public static CalculationPeriodsPrincipalExchangesAndStubs GenerateCalculationPeriodsPrincipalExchangesAndStubs(
            InterestRateStream interestRateStream, IBusinessCalendar fixingCalendar, IBusinessCalendar paymentCalendar)
        {
            CalculationPeriodDates calculationPeriodDates    = interestRateStream.calculationPeriodDates;
            AdjustableDate         adjustableEffectiveDate   = XsdClassesFieldResolver.CalculationPeriodDatesGetEffectiveDate(calculationPeriodDates);
            AdjustableDate         adjustableTerminationDate = XsdClassesFieldResolver.CalculationPeriodDatesGetTerminationDate(calculationPeriodDates);
            AdjustableDate         adjustableFirstPeriodDate = adjustableEffectiveDate;
            DateTime?firstRegularPeriodStartDate             =
                XsdClassesFieldResolver.CalculationPeriodDatesGetFirstRegularPeriodStartDate(calculationPeriodDates);
            var tempDate = XsdClassesFieldResolver.CalculationPeriodDatesGetFirstPeriodStartDate(calculationPeriodDates);

            if (tempDate != null && firstRegularPeriodStartDate != null)
            {
                adjustableFirstPeriodDate = tempDate;
                Frequency frequency = calculationPeriodDates.calculationPeriodFrequency;
                var       startDate = CalculationPeriodGenerator.AddPeriod((DateTime)firstRegularPeriodStartDate, IntervalHelper.FromFrequency(frequency), -1);
                adjustableFirstPeriodDate.unadjustedDate = IdentifiedDateHelper.Create(startDate);
            }
            DateTime?lastRegularPeriodEndDate =
                XsdClassesFieldResolver.CalculationPeriodDatesGetLastRegularPeriodEndDate(calculationPeriodDates);
            //            This assumes automatic adjustment of calculationperiods.
            CalculationPeriodsPrincipalExchangesAndStubs result = CalculationPeriodGenerator.GenerateAdjustedCalculationPeriods(
                adjustableFirstPeriodDate.unadjustedDate.Value,
                adjustableTerminationDate.unadjustedDate.Value,
                firstRegularPeriodStartDate,
                lastRegularPeriodEndDate,
                calculationPeriodDates.calculationPeriodFrequency,
                calculationPeriodDates.calculationPeriodDatesAdjustments,
                paymentCalendar);
            //Determine whether the reset dates must be calcuated.
            Calculation calculation = XsdClassesFieldResolver.CalculationPeriodAmountGetCalculation(interestRateStream.calculationPeriodAmount);

            //  Add principle exchanges if this need is defined in parametric representation of the interest rate steam.
            //
            if (null != interestRateStream.principalExchanges)
            {
                //if (paymentCalendar == null)
                //{
                //    paymentCalendar = BusinessCenterHelper.ToBusinessCalendar(cache, adjustableEffectiveDate.dateAdjustments.businessCenters);
                //}
                //  Initial PE
                //
                if (interestRateStream.principalExchanges.initialExchange)
                {
                    PrincipalExchange initialExchange = PrincipalExchangeHelper.Create(AdjustedDateHelper.ToAdjustedDate(paymentCalendar, adjustableEffectiveDate));
                    result.InitialPrincipalExchange = initialExchange;
                }
                //  intermediatory PE
                //
                if (interestRateStream.principalExchanges.intermediateExchange)
                {
                    // Generate a list of intermediatory PE exchanges
                    //
                    Notional notionalSchedule = XsdClassesFieldResolver.CalculationGetNotionalSchedule(calculation);
                    if (null != notionalSchedule.notionalStepSchedule.step)//there should be steps - otherwise NO interm. exchanges.
                    {
                        foreach (DateTime stepDate in ScheduleHelper.GetStepDates(notionalSchedule.notionalStepSchedule))
                        {
                            PrincipalExchange intermediatoryExchange = PrincipalExchangeHelper.Create(stepDate);
                            result.Add(intermediatoryExchange);
                        }
                    }
                }
                //  Final PE
                // Assume the same calendar is used for the termination date as well!
                if (interestRateStream.principalExchanges.finalExchange)
                {
                    PrincipalExchange finalExchange = PrincipalExchangeHelper.Create(AdjustedDateHelper.ToAdjustedDate(paymentCalendar, adjustableTerminationDate));
                    result.FinalPrincipalExchange = finalExchange;
                }
            }
            //Only does upfront resetRelativeTo start date.
            if (interestRateStream.resetDates != null && calculation.Items[0].GetType() == typeof(FloatingRateCalculation))
            {
                //Get the fixing date convention.
                var fixingDateConvention = interestRateStream.resetDates.resetDatesAdjustments;
                //if (fixingCalendar == null)
                //{
                //    fixingCalendar = BusinessCenterHelper.ToBusinessCalendar(cache, fixingDateConvention.businessCenters);
                //}
                foreach (var calculationPeriod in result.CalculationPeriods)
                {
                    if (calculationPeriod.adjustedStartDateSpecified)
                    {
                        //Set the adjusted fixing date.
                        var adjustedFixingDate = AdjustedDateHelper.ToAdjustedDate(fixingCalendar, calculationPeriod.adjustedStartDate,
                                                                                   fixingDateConvention);
                        var floatingRateDefinition = new FloatingRateDefinition();
                        var rateObservation        = new RateObservation
                        {
                            observedRateSpecified       = false,
                            adjustedFixingDateSpecified = true,
                            adjustedFixingDate          = adjustedFixingDate
                        };
                        floatingRateDefinition.rateObservation = new[] { rateObservation };
                        calculationPeriod.Item1 = floatingRateDefinition;
                    }
                }
                //The initial stub period.
                if (result.InitialStubCalculationPeriod != null)
                {
                    if (result.InitialStubCalculationPeriod.adjustedStartDateSpecified)
                    {
                        //Set the adjusted fixing date.
                        var adjustedFixingDate = AdjustedDateHelper.ToAdjustedDate(fixingCalendar, result.InitialStubCalculationPeriod.adjustedStartDate,
                                                                                   fixingDateConvention);
                        var floatingRateDefinition = new FloatingRateDefinition();
                        var rateObservation        = new RateObservation
                        {
                            observedRateSpecified       = false,
                            adjustedFixingDateSpecified = true,
                            adjustedFixingDate          = adjustedFixingDate
                        };
                        floatingRateDefinition.rateObservation    = new[] { rateObservation };
                        result.InitialStubCalculationPeriod.Item1 = floatingRateDefinition;
                    }
                }
                //The final stub period
                if (result.FinalStubCalculationPeriod != null)
                {
                    if (result.FinalStubCalculationPeriod.adjustedStartDateSpecified)
                    {
                        //Set the adjusted fixing date.
                        var adjustedFixingDate = AdjustedDateHelper.ToAdjustedDate(fixingCalendar, result.FinalStubCalculationPeriod.adjustedStartDate,
                                                                                   fixingDateConvention);
                        var floatingRateDefinition = new FloatingRateDefinition();
                        var rateObservation        = new RateObservation
                        {
                            observedRateSpecified       = false,
                            adjustedFixingDateSpecified = true,
                            adjustedFixingDate          = adjustedFixingDate
                        };
                        floatingRateDefinition.rateObservation  = new[] { rateObservation };
                        result.FinalStubCalculationPeriod.Item1 = floatingRateDefinition;
                    }
                }
            }
            return(result);
        }
Exemple #15
0
        private static ReadOnlyCollection <DataEntity> CreateDataEntities()
        {
            DateTime today        = DateTime.Today;
            DateTime todayPlus3M  = today.AddMonths(3);
            DateTime todayPlus4Y  = today.AddYears(4);
            DateTime todayPlus10Y = today.AddYears(10);

            Int32 tradeId = 0;

            RegulationsInfo ri = RegulationsInfo.Of(Regulation.Cftc);

            List <DataEntity> dataEntities = new List <DataEntity>
            {
                // Model - Sensitivities - Base Correlation
                Sensitivity.BaseCorrelation("CDX HY", Amount.Of(Currency.Usd, 200000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.BaseCorrelation("CDX HY", Amount.Of(Currency.Usd, -300000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.BaseCorrelation("CDX IG", Amount.Of(Currency.Usd, 100000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.BaseCorrelation("iTraxx XO", Amount.Of(Currency.Usd, 450000m), ri, CreateTradeInfoModel(++tradeId)),

                // Model - Sensitivities - Delta - Commodity
                Sensitivity.CommodityDelta("Coal Americas", BucketCommodity.Bucket1, Amount.Of(Currency.Usd, 3000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CommodityDelta("Coal Europe", BucketCommodity.Bucket1, Amount.Of(Currency.Usd, -5000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CommodityDelta("Middle Distillates America", BucketCommodity.Bucket3, Amount.Of(Currency.Usd, 15000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CommodityDelta("Middle Distillates Europe", BucketCommodity.Bucket3, Amount.Of(Currency.Usd, -20000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CommodityDelta("Middle Distillates Asia", BucketCommodity.Bucket3, Amount.Of(Currency.Usd, 32000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CommodityDelta("NA Natural Gas Gulf Coast", BucketCommodity.Bucket6, Amount.Of(Currency.Usd, 6500000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CommodityDelta("NA Natural Gas West", BucketCommodity.Bucket6, Amount.Of(Currency.Usd, 4000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CommodityDelta("Freight Wet", BucketCommodity.Bucket10, Amount.Of(Currency.Usd, 35000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CommodityDelta("Freight Dry", BucketCommodity.Bucket10, Amount.Of(Currency.Usd, -10000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CommodityDelta("Softs Coffee", BucketCommodity.Bucket14, Amount.Of(Currency.Usd, 2500000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CommodityDelta("Livestock Feeder Cattle", BucketCommodity.Bucket15, Amount.Of(Currency.Usd, -1200000m), ri, CreateTradeInfoModel(++tradeId)),

                // Model - Sensitivities - Delta - Credit Qualifying
                Sensitivity.CreditQualifyingDelta("ISIN:US3949181045", BucketCreditQualifying.Bucket1, Tenor.Y2, false, Amount.Of(Currency.Usd, 100000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditQualifyingDelta("ISIN:US3949181045", BucketCreditQualifying.Bucket1, Tenor.Y5, false, Amount.Of(Currency.Usd, -1500000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditQualifyingDelta("ISIN:US3949181045", BucketCreditQualifying.Bucket1, Tenor.Y3, false, Amount.Of(Currency.Usd, 1450000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditQualifyingDelta("ISIN:XS1061333921", BucketCreditQualifying.Bucket1, Tenor.Y10, false, Amount.Of(Currency.Usd, 400000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditQualifyingDelta("ISIN:CH0419041295", BucketCreditQualifying.Bucket4, Tenor.Y1, true, Amount.Of(Currency.Usd, -650000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditQualifyingDelta("ISIN:JP1718441K71", BucketCreditQualifying.Bucket4, Tenor.Y1, false, Amount.Of(Currency.Usd, 200000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditQualifyingDelta("ISIN:RU000A100H37", BucketCreditQualifying.Bucket7, Tenor.Y2, false, Amount.Of(Currency.Usd, -100000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditQualifyingDelta("ISIN:RU000A100H37", BucketCreditQualifying.Bucket7, Tenor.Y3, false, Amount.Of(Currency.Usd, 150000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditQualifyingDelta("ISIN:XS1886258598", BucketCreditQualifying.Bucket7, Tenor.Y1, false, Amount.Of(Currency.Usd, -120000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditQualifyingDelta("ISIN:XS1120672716", BucketCreditQualifying.Bucket7, Tenor.Y2, false, Amount.Of(Currency.Usd, 330000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditQualifyingDelta("ISIN:GB0702134646", BucketCreditQualifying.Bucket11, Tenor.Y2, false, Amount.Of(Currency.Usd, 1000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditQualifyingDelta("ISIN:GB0702134646", BucketCreditQualifying.Bucket11, Tenor.Y10, false, Amount.Of(Currency.Usd, -475000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditQualifyingDelta("ISIN:GB0702134646", BucketCreditQualifying.Bucket11, Tenor.Y3, false, Amount.Of(Currency.Usd, -500000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditQualifyingDelta("ISIN:FR0003504418", BucketCreditQualifying.BucketResidual, Tenor.Y2, false, Amount.Of(Currency.Usd, 400000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditQualifyingDelta("ISIN:XS2023221601", BucketCreditQualifying.BucketResidual, Tenor.Y10, false, Amount.Of(Currency.Usd, -300000m), ri, CreateTradeInfoModel(++tradeId)),

                // Model - Sensitivities - Delta - Credit Non-qualifying
                Sensitivity.CreditNonQualifyingDelta("ISIN:US3949181045", BucketCreditNonQualifying.Bucket1, Tenor.Y3, Amount.Of(Currency.Usd, 300000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditNonQualifyingDelta("ISIN:US3949181045", BucketCreditNonQualifying.Bucket1, Tenor.Y5, Amount.Of(Currency.Usd, 700000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditNonQualifyingDelta("ISIN:XS1061333921", BucketCreditNonQualifying.Bucket1, Tenor.Y2, Amount.Of(Currency.Usd, -500000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditNonQualifyingDelta("ISIN:XS1980681200", BucketCreditNonQualifying.Bucket2, Tenor.Y1, Amount.Of(Currency.Usd, -220000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditNonQualifyingDelta("ISIN:XS1980681200", BucketCreditNonQualifying.Bucket2, Tenor.Y10, Amount.Of(Currency.Usd, 200000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditNonQualifyingDelta("ISIN:DE000HVB34J9", BucketCreditNonQualifying.Bucket2, Tenor.Y2, Amount.Of(Currency.Usd, 800000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditNonQualifyingDelta("ISIN:FR0003507418", BucketCreditNonQualifying.BucketResidual, Tenor.Y5, Amount.Of(Currency.Usd, 300000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditNonQualifyingDelta("ISIN:XS2023221601", BucketCreditNonQualifying.BucketResidual, Tenor.Y3, Amount.Of(Currency.Usd, -270000m), ri, CreateTradeInfoModel(++tradeId)),

                // Model - Sensitivities - Delta - Equity
                Sensitivity.EquityDelta("ISIN:XS1980681200", BucketEquity.Bucket2, Amount.Of(Currency.Usd, 200000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.EquityDelta("ISIN:DE000HVB34J9", BucketEquity.Bucket2, Amount.Of(Currency.Usd, 500000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.EquityDelta("ISIN:DE000TK0T291", BucketEquity.Bucket5, Amount.Of(Currency.Usd, -1000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.EquityDelta("ISIN:DE000FF2AKA7", BucketEquity.Bucket5, Amount.Of(Currency.Usd, 3300000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.EquityDelta("ISIN:XS1896686544", BucketEquity.Bucket5, Amount.Of(Currency.Usd, 500000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.EquityDelta("ISIN:BE5631439402", BucketEquity.Bucket9, Amount.Of(Currency.Usd, 100000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.EquityDelta("ISIN:XS1006556794", BucketEquity.Bucket10, Amount.Of(Currency.Usd, 50000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.EquityDelta("ISIN:GB02BALKJB79", BucketEquity.Bucket10, Amount.Of(Currency.Usd, -150000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.EquityDelta("FTSE100", BucketEquity.Bucket11, Amount.Of(Currency.Usd, 600000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.EquityDelta("S&P500", BucketEquity.Bucket11, Amount.Of(Currency.Usd, -450000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.EquityDelta("ISIN:FR0003504418", BucketEquity.BucketResidual, Amount.Of(Currency.Usd, -75000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.EquityDelta("ISIN:XS2023221601", BucketEquity.BucketResidual, Amount.Of(Currency.Usd, 56000m), ri, CreateTradeInfoModel(++tradeId)),

                // Model - Sensitivities - Delta - FX
                Sensitivity.FxDelta(Currency.Eur, Amount.Of(Currency.Usd, 10000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.FxDelta(Currency.Eur, Amount.Of(Currency.Usd, -10000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.FxDelta(Currency.Nok, Amount.Of(Currency.Usd, 200000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.FxDelta(Currency.Mru, Amount.Of(Currency.Usd, 60000000m), ri, CreateTradeInfoModel(++tradeId)),

                // Model - Sensitivities - Delta - Rates - Cross-currency Basis
                Sensitivity.CrossCurrencyBasis(Currency.Gbp, Amount.Of(Currency.Usd, -15000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CrossCurrencyBasis(Currency.Usd, Amount.Of(Currency.Usd, 10000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CrossCurrencyBasis(Currency.Usd, Amount.Of(Currency.Usd, 10000000m), ri, CreateTradeInfoModel(++tradeId)),

                // Sensitivities - Delta - Rates - Inflation
                Sensitivity.InflationDelta(Currency.Cad, Amount.Of(Currency.Usd, 3000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.InflationDelta(Currency.Gbp, Amount.Of(Currency.Usd, -10000000m), ri, CreateTradeInfoModel(++tradeId)),

                // Model - Sensitivities - Delta - Rates - Interest Rate
                Sensitivity.InterestRateDelta(Currency.Gbp, Tenor.Y5, Curve.Libor6M, Amount.Of(Currency.Usd, -5000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.InterestRateDelta(Currency.Gbp, Tenor.M6, Curve.Ois, Amount.Of(Currency.Usd, 20000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.InterestRateDelta(Currency.Gbp, Tenor.Y2, Curve.Ois, Amount.Of(Currency.Usd, 30000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.InterestRateDelta(Currency.Jpy, Tenor.Y10, Curve.Libor3M, Amount.Of(Currency.Usd, 9000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.InterestRateDelta(Currency.Jpy, Tenor.Y20, Curve.Libor3M, Amount.Of(Currency.Usd, 1000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.InterestRateDelta(Currency.Inr, Tenor.W2, Curve.Ois, Amount.Of(Currency.Usd, -2000000m), ri, CreateTradeInfoModel(++tradeId)),

                // Model - Sensitivities - Vega - Commodity
                Sensitivity.CommodityVega("Precious Metals Silver", BucketCommodity.Bucket12, Tenor.W2, Amount.Of(Currency.Usd, 3500000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CommodityVega("Precious Metals Silver", BucketCommodity.Bucket12, Tenor.Y5, Amount.Of(Currency.Usd, -3200000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CommodityVega("Precious Metals Gold", BucketCommodity.Bucket12, Tenor.M6, Amount.Of(Currency.Usd, 1500000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CommodityVega("EU Power Germany", BucketCommodity.Bucket9, Tenor.Y1, Amount.Of(Currency.Usd, 1000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CommodityVega("EU Power Germany", BucketCommodity.Bucket9, Tenor.W2, Amount.Of(Currency.Usd, 4500000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CommodityVega("Crude Oil Americas", BucketCommodity.Bucket2, Tenor.Y15, Amount.Of(Currency.Usd, -1500000m), ri, CreateTradeInfoModel(++tradeId)),

                // Model - Sensitivities - Vega - Credit Qualifying
                Sensitivity.CreditQualifyingVega("EU.HY", BucketCreditQualifying.BucketResidual, Tenor.Y5, Amount.Of(Currency.Usd, -4000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditQualifyingVega("EU.IG", BucketCreditQualifying.BucketResidual, Tenor.Y1, Amount.Of(Currency.Usd, 1500000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditQualifyingVega("EU.IG", BucketCreditQualifying.Bucket2, Tenor.Y2, Amount.Of(Currency.Usd, 3000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditQualifyingVega("EU.IG", BucketCreditQualifying.Bucket2, Tenor.Y2, Amount.Of(Currency.Usd, -2000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditQualifyingVega("US.HY", BucketCreditQualifying.Bucket7, Tenor.Y10, Amount.Of(Currency.Usd, 3500000m), ri, CreateTradeInfoModel(++tradeId)),

                // Model - Sensitivities - Vega - Credit Non-qualifying
                Sensitivity.CreditNonQualifyingVega("EU.HY", BucketCreditNonQualifying.BucketResidual, Tenor.Y3, Amount.Of(Currency.Usd, 1200000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditNonQualifyingVega("EU.IG", BucketCreditNonQualifying.Bucket1, Tenor.Y2, Amount.Of(Currency.Usd, -2300000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditNonQualifyingVega("EU.IG", BucketCreditNonQualifying.BucketResidual, Tenor.Y3, Amount.Of(Currency.Usd, 4000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditNonQualifyingVega("EU.IG", BucketCreditNonQualifying.BucketResidual, Tenor.Y1, Amount.Of(Currency.Usd, -3500000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.CreditNonQualifyingVega("US.HY", BucketCreditNonQualifying.BucketResidual, Tenor.Y10, Amount.Of(Currency.Usd, -2600000m), ri, CreateTradeInfoModel(++tradeId)),

                // Model - Sensitivities - Vega - Equity
                Sensitivity.EquityVega("ISIN:US3949181045", BucketEquity.Bucket1, Tenor.Y5, Amount.Of(Currency.Usd, 2000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.EquityVega("ISIN:US3949181045", BucketEquity.Bucket1, Tenor.Y2, Amount.Of(Currency.Usd, -1800000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.EquityVega("ISIN:US3949181045", BucketEquity.Bucket1, Tenor.W2, Amount.Of(Currency.Usd, 6000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.EquityVega("ISIN:CH0419041295", BucketEquity.Bucket4, Tenor.Y3, Amount.Of(Currency.Usd, 5000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.EquityVega("ISIN:DE000HVB34J9", BucketEquity.Bucket4, Tenor.Y10, Amount.Of(Currency.Usd, -4500000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.EquityVega("ISIN:RU000A100H37", BucketEquity.Bucket7, Tenor.Y20, Amount.Of(Currency.Usd, -2700000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.EquityVega("VIX", BucketEquity.Bucket12, Tenor.Y15, Amount.Of(Currency.Usd, -1500000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.EquityVega("ISIN:FR0003504418", BucketEquity.BucketResidual, Tenor.M6, Amount.Of(Currency.Usd, 3000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.EquityVega("ISIN:FR0003504418", BucketEquity.BucketResidual, Tenor.M1, Amount.Of(Currency.Usd, -3200000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.EquityVega("ISIN:XS2023221601", BucketEquity.BucketResidual, Tenor.M3, Amount.Of(Currency.Usd, 4400000m), ri, CreateTradeInfoModel(++tradeId)),

                // Model - Sensitivities - Vega - FX
                Sensitivity.FxVega(CurrencyPair.Of(Currency.Usd, Currency.Eur), Tenor.M6, Amount.Of(Currency.Usd, 2500000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.FxVega(CurrencyPair.Of(Currency.Eur, Currency.Usd), Tenor.Y3, Amount.Of(Currency.Usd, 8500000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.FxVega(CurrencyPair.Of(Currency.Usd, Currency.Eur), Tenor.Y20, Amount.Of(Currency.Usd, -10000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.FxVega(CurrencyPair.Of(Currency.Brl, Currency.Cny), Tenor.Y2, Amount.Of(Currency.Usd, 6500000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.FxVega(CurrencyPair.Of(Currency.Jpy, Currency.Sgd), Tenor.M6, Amount.Of(Currency.Usd, -2500000m), ri, CreateTradeInfoModel(++tradeId)),

                // Sensitivities - Delta - Vega - Inflation
                Sensitivity.InflationVega(Currency.Eur, Tenor.Y5, Amount.Of(Currency.Usd, 15000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.InflationVega(Currency.Eur, Tenor.Y15, Amount.Of(Currency.Usd, -50000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.InflationVega(Currency.Usd, Tenor.Y20, Amount.Of(Currency.Usd, 100000000m), ri, CreateTradeInfoModel(++tradeId)),

                // Model - Sensitivities - Vega - Rates - Interest Rate
                Sensitivity.InterestRateVega(Currency.Usd, Tenor.M3, Amount.Of(Currency.Usd, 20000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.InterestRateVega(Currency.Usd, Tenor.Y1, Amount.Of(Currency.Usd, -30000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.InterestRateVega(Currency.Aud, Tenor.W2, Amount.Of(Currency.Usd, -13000000m), ri, CreateTradeInfoModel(++tradeId)),
                Sensitivity.InterestRateVega(Currency.Aud, Tenor.Y2, Amount.Of(Currency.Usd, -2500000m), ri, CreateTradeInfoModel(++tradeId)),

                // Model - Add-on - Fixed Amounts
                AddOnFixedAmount.Of(Amount.Of(Currency.Usd, 1650000m), ri),
                AddOnFixedAmount.Of(Amount.Of(Currency.Usd, 2000000m), ri),

                // Model - Add-on - Notionals
                AddOnNotional.Of("FlexiCallOption", Amount.Of(Currency.Usd, 1000000m), ri, CreateTradeInfoModel(++tradeId)),
                AddOnNotional.Of("FlexiCallOption", Amount.Of(Currency.Usd, -2000000m), ri, CreateTradeInfoModel(++tradeId)),
                AddOnNotional.Of("FlexiCallOption", Amount.Of(Currency.Usd, 1500000m), ri, CreateTradeInfoModel(++tradeId)),
                AddOnNotional.Of("FlexiPutOption", Amount.Of(Currency.Usd, -800000m), ri, CreateTradeInfoModel(++tradeId)),
                AddOnNotional.Of("FlexiPutOption", Amount.Of(Currency.Usd, -2200000m), ri, CreateTradeInfoModel(++tradeId)),

                // Model - Add-on - Notional Factors
                AddOnNotionalFactor.Of("FlexiCallOption", 0.06105m, ri),
                AddOnNotionalFactor.Of("FlexiPutOption", 0.02055m, ri),

                // Model - Add-on - Product Multipliers
                AddOnProductMultiplier.Of(Model.Product.Commodity, 0.075m, ri),
                AddOnProductMultiplier.Of(Model.Product.Credit, 0.11m, ri),
                AddOnProductMultiplier.Of(Model.Product.Equity, 0.015m, ri),
                AddOnProductMultiplier.Of(Model.Product.RatesFx, 0.205m, ri),

                // Schedule - Notionals
                Notional.Of(Schedule.Product.Commodity, Amount.Of(Currency.Cad, 1850000m), ri, CreateTradeInfoSchedule(1, todayPlus3M)),
                Notional.Of(Schedule.Product.Credit, Amount.Of(Currency.Usd, 2300000m), ri, CreateTradeInfoSchedule(2, todayPlus3M)),
                Notional.Of(Schedule.Product.Credit, Amount.Of(Currency.Usd, -900000m), ri, CreateTradeInfoSchedule(3, todayPlus10Y)),
                Notional.Of(Schedule.Product.Fx, Amount.Of(Currency.Usd, -5200000m), ri, CreateTradeInfoSchedule(4, todayPlus3M)),
                Notional.Of(Schedule.Product.Equity, Amount.Of(Currency.Usd, 1200000m), ri, CreateTradeInfoSchedule(5, todayPlus4Y)),
                Notional.Of(Schedule.Product.Rates, Amount.Of(Currency.Usd, 3700000m), ri, CreateTradeInfoSchedule(6, todayPlus3M)),
                Notional.Of(Schedule.Product.Rates, Amount.Of(Currency.Usd, -2000000m), ri, CreateTradeInfoSchedule(7, todayPlus4Y)),
                Notional.Of(Schedule.Product.Rates, Amount.Of(Currency.Gbp, -1750000m), ri, CreateTradeInfoSchedule(8, todayPlus10Y)),
                Notional.Of(Schedule.Product.Rates, Amount.Of(Currency.Eur, 1620000m), ri, CreateTradeInfoSchedule(8, todayPlus10Y)),
                Notional.Of(Schedule.Product.Other, Amount.Of(Currency.Usd, -120000m), ri, CreateTradeInfoSchedule(9, todayPlus3M)),
                Notional.Of(Schedule.Product.Other, Amount.Of(Currency.Usd, 2140000m), ri, CreateTradeInfoSchedule(9, todayPlus3M)),
                Notional.Of(Schedule.Product.Other, Amount.Of(Currency.Usd, 4350000m), ri, CreateTradeInfoSchedule(10, todayPlus4Y)),
                Notional.Of(Schedule.Product.Other, Amount.Of(Currency.Usd, 4100000m), ri, CreateTradeInfoSchedule(11, todayPlus10Y)),
                Notional.Of(Schedule.Product.Other, Amount.Of(Currency.Usd, -5120000m), ri, CreateTradeInfoSchedule(11, todayPlus10Y)),

                // Schedule - Present Values
                PresentValue.Of(Schedule.Product.Commodity, Amount.Of(Currency.Usd, 490000m), ri, CreateTradeInfoSchedule(1, todayPlus3M)),
                PresentValue.Of(Schedule.Product.Credit, Amount.Of(Currency.Usd, -60000m), ri, CreateTradeInfoSchedule(2, todayPlus3M)),
                PresentValue.Of(Schedule.Product.Credit, Amount.Of(Currency.Usd, 610000m), ri, CreateTradeInfoSchedule(3, todayPlus10Y)),
                PresentValue.Of(Schedule.Product.Fx, Amount.Of(Currency.Usd, 320000m), ri, CreateTradeInfoSchedule(4, todayPlus3M)),
                PresentValue.Of(Schedule.Product.Equity, Amount.Of(Currency.Usd, -230000m), ri, CreateTradeInfoSchedule(5, todayPlus4Y)),
                PresentValue.Of(Schedule.Product.Rates, Amount.Of(Currency.Usd, 1850000m), ri, CreateTradeInfoSchedule(6, todayPlus3M)),
                PresentValue.Of(Schedule.Product.Rates, Amount.Of(Currency.Usd, -450000m), ri, CreateTradeInfoSchedule(7, todayPlus4Y)),
                PresentValue.Of(Schedule.Product.Rates, Amount.Of(Currency.Gbp, -170000m), ri, CreateTradeInfoSchedule(8, todayPlus10Y)),
                PresentValue.Of(Schedule.Product.Rates, Amount.Of(Currency.Eur, 260000m), ri, CreateTradeInfoSchedule(8, todayPlus10Y)),
                PresentValue.Of(Schedule.Product.Other, Amount.Of(Currency.Usd, -60000m), ri, CreateTradeInfoSchedule(9, todayPlus3M)),
                PresentValue.Of(Schedule.Product.Other, Amount.Of(Currency.Usd, -240000m), ri, CreateTradeInfoSchedule(11, todayPlus10Y)),
            };

            return(dataEntities.AsReadOnly());
        }