-
Notifications
You must be signed in to change notification settings - Fork 0
/
xDealCashflowListInterestSpread.cs
601 lines (520 loc) · 26.4 KB
/
xDealCashflowListInterestSpread.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing.Design;
using System.Linq;
using SunGard.Adaptiv.Analytics.Framework;
namespace SunGard.Adaptiv.Analytics.Models
{
/// <summary>
/// Interest rate spread cashflow list deal.
/// </summary>
[Serializable]
[DisplayName("Floating Interest Spread Cashflow List")]
public class CFGeneralInterestSpreadListDeal : CFListBaseDeal<CFGeneralInterestSpreadList>
{
private const int AccrualHolidayCalendarIndex = 0;
private const int Rate1HolidayCalendarIndex = 1;
private const int Rate2HolidayCalendarIndex = 2;
/// <summary>
/// Constructor for floating interest spread cashflow list deal.
/// </summary>
public CFGeneralInterestSpreadListDeal()
{
// cap and swaption vols distinct. base class provides cap vols, these are the distinct swaption vols
Discount_Rate_Swaption_Volatility = string.Empty;
Discount_Rate_Cap_Volatility = string.Empty;
Forecast_Rate1_Swaption_Volatility = string.Empty;
Forecast_Rate1_Cap_Volatility = string.Empty;
Forecast_Rate2_Swaption_Volatility = string.Empty;
Forecast_Rate2_Cap_Volatility = string.Empty;
Accrual_Calendars = string.Empty;
Rate1_Calendars = string.Empty;
Rate2_Calendars = string.Empty;
Rate_Adjustment_Method = DateAdjustmentMethod.Modified_Following;
Rate_Sticky_Month_End = YesNo.Yes;
}
/// <summary>
/// Gets or sets the discount rate cap volatility price factor.
/// </summary>
[NonMandatory]
public string Discount_Rate_Cap_Volatility
{
get { return fDiscountVolatility; }
set { fDiscountVolatility = value; }
}
/// <summary>
/// Gets or sets the discount rate swaption volatility price factor.
/// </summary>
[NonMandatory]
public string Discount_Rate_Swaption_Volatility
{
get;
set;
}
/// <summary>
/// Gets or sets the forecast interest rate1.
/// </summary>
[NonMandatory]
public string Forecast_Rate1
{
get { return fForecast; }
set { fForecast = value; }
}
/// <summary>
/// Gets or sets the forecast interest rate2.
/// </summary>
[NonMandatory]
public string Forecast_Rate2
{
get { return fForecast2; }
set { fForecast2 = value; }
}
/// <summary>
/// Gets or sets the rate1 cap volatility price factor.
/// </summary>
[NonMandatory]
public string Forecast_Rate1_Cap_Volatility
{
get { return fForecastVolatility; }
set { fForecastVolatility = value; }
}
/// <summary>
/// Gets or sets the rate1 swaption volatility price factor.
/// </summary>
[NonMandatory]
public string Forecast_Rate1_Swaption_Volatility
{
get;
set;
}
/// <summary>
/// Gets or sets the rate2 cap volatility price factor.
/// </summary>
[NonMandatory]
public string Forecast_Rate2_Cap_Volatility
{
get;
set;
}
/// <summary>
/// Gets or sets the rate2 swaption volatility price factor.
/// </summary>
[NonMandatory]
public string Forecast_Rate2_Swaption_Volatility
{
get;
set;
}
/// <summary>
/// Gets or set the list of holiday calendars for interest accrual dates.
/// </summary>
[NonMandatory]
[LocationStringsFormAttribute]
[Editor(typeof(ModalEditor), typeof(UITypeEditor))]
public string Accrual_Calendars
{
get { return GetCalendarNames(AccrualHolidayCalendarIndex); }
set { SetCalendarNames(AccrualHolidayCalendarIndex, value); }
}
/// <summary>
/// Gets or set the list of holiday calendars for the rate1 dates.
/// </summary>
[NonMandatory]
[LocationStringsFormAttribute]
[Editor(typeof(ModalEditor), typeof(UITypeEditor))]
public string Rate1_Calendars
{
get { return GetCalendarNames(Rate1HolidayCalendarIndex); }
set { SetCalendarNames(Rate1HolidayCalendarIndex, value); }
}
/// <summary>
/// Gets or set the list of holiday calendars for the rate2 dates.
/// </summary>
[NonMandatory]
[LocationStringsFormAttribute]
[Editor(typeof(ModalEditor), typeof(UITypeEditor))]
public string Rate2_Calendars
{
get { return GetCalendarNames(Rate2HolidayCalendarIndex); }
set { SetCalendarNames(Rate2HolidayCalendarIndex, value); }
}
/// <summary>
/// Number of business days between reset date and rate start date.
/// </summary>
[NonMandatory]
public int Rate_Offset
{
get;
set;
}
/// <summary>
/// Adjustment method for rate end date calculations.
/// </summary>
[NonMandatory]
public DateAdjustmentMethod Rate_Adjustment_Method
{
get;
set;
}
/// <summary>
/// Force rate end date to be last business day of month when rate start date is last business day of month.
/// </summary>
public YesNo Rate_Sticky_Month_End
{
get;
set;
}
/// <summary>
/// Gets the accrual holiday calendar.
/// </summary>
public IHolidayCalendar AccrualHolidayCalendar()
{
return GetHolidayCalendar(AccrualHolidayCalendarIndex);
}
/// <summary>
/// Gets the rate1 holiday calendar.
/// </summary>
public IHolidayCalendar Rate1HolidayCalendar()
{
return GetHolidayCalendar(Rate1HolidayCalendarIndex);
}
/// <summary>
/// Gets the rate2 holiday calendar.
/// </summary>
public IHolidayCalendar Rate2HolidayCalendar()
{
return GetHolidayCalendar(Rate2HolidayCalendarIndex);
}
/// <summary>
/// Validate deal properties.
/// </summary>
public override void Validate(ICalendarData calendar, ErrorList errors)
{
InitialiseHolidayCalendars(calendar);
var parameters = new CashflowListDateGenerationParameters()
{
AccrualCalendar = AccrualHolidayCalendar(),
RateCalendar = Rate1HolidayCalendar(),
Rate1Calendar = Rate1HolidayCalendar(),
Rate2Calendar = Rate2HolidayCalendar(),
RateOffset = Rate_Offset,
RateAdjustmentMethod = Rate_Adjustment_Method,
RateStickyMonthEnd = Rate_Sticky_Month_End,
};
if (fCashflows.FinishBuild(parameters))
AddToErrors(errors, ErrorLevel.Info, "Missing cashflow properties have been calculated (Accrual_Year_Fraction, Rate_Start_Date, Rate1_End_Date, Rate1_Year_Fraction, Rate2_End_Date, Rate2_Year_Fraction)");
base.Validate(calendar, errors);
}
}
/// <summary>
/// Valuation class for floating interest spread cashflow list deal.
/// </summary>
[Serializable]
[DisplayName("Floating Interest Spread Cashflow List Valuation")]
public class CFGeneralInterestSpreadListValuation : CFListBaseValuation<CFGeneralInterestSpreadList>
{
[NonSerialized]
protected IInterestRateVol fDiscountRateVol = null;
[NonSerialized]
protected IInterestYieldVol fDiscountYieldVol = null;
[NonSerialized]
protected IInterestRateVol fForecast1RateVol = null;
[NonSerialized]
protected IInterestYieldVol fForecast1YieldVol = null;
[NonSerialized]
protected IInterestRateVol fForecast2RateVol = null;
[NonSerialized]
protected IInterestYieldVol fForecast2YieldVol = null;
[NonSerialized]
protected FXVolHelper fFx1Vol = null;
[NonSerialized]
protected FXVolHelper fFx2Vol = null;
[NonSerialized]
protected CorrelationHelper fForecast1Fx1Correl = null;
[NonSerialized]
protected CorrelationHelper fForecast2Fx2Correl = null;
[NonSerialized]
protected CorrelationHelper fForecast1DiscountCorrel = null;
[NonSerialized]
protected CorrelationHelper fForecast2DiscountCorrel = null;
[NonSerialized]
protected CorrelationHelper fForecast1Forecast2Correl = null;
[NonSerialized]
protected CMSRateCorrelations fForecast1Forecast2Correls = null;
protected BasisPoint fConvexityLowRateCutoff = BasisPoint.BasisPointValue;
/// <summary>
/// The cashflows that will be used in valuation. This is either the cashflows from the
/// original deal or a modified clone of them.
/// </summary>
private CFGeneralInterestSpreadList fCashflows;
/// <summary>
/// Gets or sets the Convexity_Correction valuation model parameter (Yes or No).
/// </summary>
public YesNo Convexity_Correction
{
get; set;
}
/// <summary>
/// Gets or sets the Quanto_Correction valuation model parameter (Yes or No).
/// </summary>
public YesNo Quanto_Correction
{
get; set;
}
/// <summary>
/// Gets or sets the Convexity_Low_Rate_Limit_Cutoff valuation model parameter.
/// </summary>
public BasisPoint Convexity_Low_Rate_Cutoff
{
get
{
return fConvexityLowRateCutoff;
}
set
{
if (value < CalcUtils.TINY || value > 1.0)
throw new ArgumentOutOfRangeException("value", "Convexity low rate cutoff cannot be less than 0.000001 bp or more than 10000 bp");
fConvexityLowRateCutoff = value;
}
}
/// <summary>
/// Type of deals that this class can value.
/// </summary>
public override Type DealType()
{
return typeof(CFGeneralInterestSpreadListDeal);
}
/// <summary>
/// Register price factors.
/// </summary>
public override void RegisterFactors(PriceFactorList factors, ErrorList errors)
{
base.RegisterFactors(factors, errors);
CFGeneralInterestSpreadListDeal deal = (CFGeneralInterestSpreadListDeal)Deal;
// Collect registered volatility price factors to check they have the same distribution type
var volPriceFactors = new List<IInterestVol>();
// Get spread flow characteristics
SpreadCashflowListCharacteristics spreadCashflowCharacteristics = deal.Cashflows.ValuationPriceFactorDependencies(factors.BaseDate, fCurrency, fForecastCurrency, fForecast2Currency);
// register volatility surfaces for forecast rate1
if (spreadCashflowCharacteristics.NeedForecast1YieldVol)
volPriceFactors.Add(InterestVolBase.RegisterInterestYieldVol(factors, deal.Forecast_Rate1_Swaption_Volatility, fForecastCurrency));
if (spreadCashflowCharacteristics.NeedForecast1RateVol)
volPriceFactors.Add(InterestVolBase.RegisterInterestRateVol(factors, deal.Forecast_Rate1_Cap_Volatility, fForecastCurrency));
// register volatility surfaces for forecast rate2
if (spreadCashflowCharacteristics.NeedForecast2YieldVol)
volPriceFactors.Add(InterestVolBase.RegisterInterestYieldVol(factors, deal.Forecast_Rate2_Swaption_Volatility, fForecast2Currency));
if (spreadCashflowCharacteristics.NeedForecast2RateVol)
volPriceFactors.Add(InterestVolBase.RegisterInterestRateVol(factors, deal.Forecast_Rate2_Cap_Volatility, fForecast2Currency));
// vol surfaces for discount rate
if (spreadCashflowCharacteristics.NeedDiscountYieldVol)
volPriceFactors.Add(InterestVolBase.RegisterInterestYieldVol(factors, deal.Discount_Rate_Swaption_Volatility, fCurrency));
if (spreadCashflowCharacteristics.NeedDiscountRateVol)
volPriceFactors.Add(InterestVolBase.RegisterInterestRateVol(factors, deal.Discount_Rate_Cap_Volatility, fCurrency));
bool convexity = spreadCashflowCharacteristics.NeedDiscountYieldVol || spreadCashflowCharacteristics.NeedDiscountRateVol;
if (fForecastCurrency != fCurrency)
{
if (Quanto_Correction == YesNo.Yes)
{
// fx vol, fx/ir correl and forecast/discount correl
FXVolHelper.Register(factors, fForecastCurrency, fCurrency);
CorrelationHelper.Register(factors, typeof(IInterestRate), fForecastCurrency, null, typeof(IFxRate), fForecastCurrency, fCurrency);
}
if (convexity)
CorrelationHelper.Register(factors, typeof(IInterestRate), fCurrency, null, typeof(IInterestRate), fForecastCurrency, null);
}
if (fForecast2Currency != fCurrency)
{
if (Quanto_Correction == YesNo.Yes)
{
// fx vol, fx/ir correl and forecast/discount correl
FXVolHelper.Register(factors, fForecast2Currency, fCurrency);
CorrelationHelper.Register(factors, typeof(IInterestRate), fForecast2Currency, null, typeof(IFxRate), fForecast2Currency, fCurrency);
}
if (convexity)
CorrelationHelper.Register(factors, typeof(IInterestRate), fCurrency, null, typeof(IInterestRate), fForecast2Currency, null);
}
if (spreadCashflowCharacteristics.NeedForecast1Forecast2Correlation)
{
if (fForecastCurrency == fForecast2Currency)
{
// correl between forecast rates in same currency
factors.Register<CMSRateCorrelations>(fForecastCurrency);
}
else
{
CorrelationHelper.Register(factors, typeof(IInterestRate), fForecastCurrency, null, typeof(IInterestRate), fForecast2Currency, null);
}
}
if (volPriceFactors.Select(pf => pf.GetDistributionType()).Distinct().Count() > 1)
Deal.AddToErrors(errors, "Volatility price factors must have the same distribution type.");
ValidateUnnecessaryVolatilities(deal, spreadCashflowCharacteristics, errors);
}
/// <summary>
/// Clones the cashflow list and applies missing fixings from the fixings file. If
/// fixings are applied, the clone is stored in place of the original deal.
/// </summary>
public override void HeadNodeInitialize(PriceFactorList factors, BaseTimeGrid baseTimes, RequiredResults requiredResults)
{
base.HeadNodeInitialize(factors, baseTimes, requiredResults);
var baseDate = factors.BaseDate;
var deal = (CFGeneralInterestSpreadListDeal)fDeal;
fCashflows = deal.Cashflows;
// Apply any missing rate fixings.
if (fCashflows.HasMissingRates(baseDate))
fCashflows = CashflowsFixingsHelper.ApplyRateFixings(factors, deal, fCashflows);
}
/// <summary>
/// Prepare for valuation anything that is not dependent upon the scenario.
/// </summary>
public override void PreCloneInitialize(PriceFactorList factors, BaseTimeGrid baseTimes, RequiredResults requiredResults)
{
base.PreCloneInitialize(factors, baseTimes, requiredResults);
// Set up cashflow list
fCashflows.SetUseConvexityCorrection(Convexity_Correction == YesNo.Yes);
fCashflows.SetUseQuantoCorrection(Quanto_Correction == YesNo.Yes);
fCashflows.SetConvexityLowRateCutoff(Convexity_Low_Rate_Cutoff);
// Add to valuation time grid
fT.AddPayDates(fCashflows);
}
/// <summary>
/// Prepare for valuation.
/// </summary>
public override void PreValue(PriceFactorList factors)
{
base.PreValue(factors);
CFGeneralInterestSpreadListDeal deal = (CFGeneralInterestSpreadListDeal)Deal;
// Get spread flow characteristics
SpreadCashflowListCharacteristics spreadCashflowCharacteristics = fCashflows.ValuationPriceFactorDependencies(factors.BaseDate, fCurrency, fForecastCurrency, fForecast2Currency);
// vols for first forecast rate
if (spreadCashflowCharacteristics.NeedForecast1YieldVol)
fForecast1YieldVol = InterestVolBase.GetYieldVol(factors, deal.Forecast_Rate1_Swaption_Volatility, fForecastCurrency);
if (spreadCashflowCharacteristics.NeedForecast1RateVol)
fForecast1RateVol = InterestVolBase.GetRateVol(factors, deal.Forecast_Rate1_Cap_Volatility, fForecastCurrency);
// vols for second forecast rate
if (spreadCashflowCharacteristics.NeedForecast2YieldVol)
fForecast2YieldVol = InterestVolBase.GetYieldVol(factors, deal.Forecast_Rate2_Swaption_Volatility, fForecast2Currency);
if (spreadCashflowCharacteristics.NeedForecast2RateVol)
fForecast2RateVol = InterestVolBase.GetRateVol(factors, deal.Forecast_Rate2_Cap_Volatility, fForecast2Currency);
// vols for discount rate
if (spreadCashflowCharacteristics.NeedDiscountYieldVol)
fDiscountYieldVol = InterestVolBase.GetYieldVol(factors, deal.Discount_Rate_Swaption_Volatility, fCurrency);
if (spreadCashflowCharacteristics.NeedDiscountRateVol)
fDiscountRateVol = InterestVolBase.GetRateVol(factors, deal.Discount_Rate_Cap_Volatility, fCurrency);
bool convexity = spreadCashflowCharacteristics.NeedDiscountYieldVol || spreadCashflowCharacteristics.NeedDiscountRateVol;
if (fForecastCurrency != fCurrency)
{
if (Quanto_Correction == YesNo.Yes)
{
// fx vol, fx/ir correl and forecast/discount correl
fFx1Vol = FXVolHelper.Get(factors, fForecastCurrency, fCurrency);
fForecast1Fx1Correl = CorrelationHelper.Get(factors, typeof(InterestRate), fForecastCurrency, null, typeof(FxRate), fForecastCurrency, fCurrency);
}
if (convexity)
fForecast1DiscountCorrel = CorrelationHelper.Get(factors, typeof(InterestRate), fCurrency, null, typeof(InterestRate), fForecastCurrency, null);
}
if (fForecast2Currency != fCurrency)
{
if (Quanto_Correction == YesNo.Yes)
{
// fx vol, fx/ir correl and forecast/discount correl
fFx2Vol = FXVolHelper.Get(factors, fForecast2Currency, fCurrency);
fForecast2Fx2Correl = CorrelationHelper.Get(factors, typeof(InterestRate), fForecast2Currency, null, typeof(FxRate), fForecast2Currency, fCurrency);
}
if (convexity)
fForecast2DiscountCorrel = CorrelationHelper.Get(factors, typeof(InterestRate), fCurrency, null, typeof(InterestRate), fForecast2Currency, null);
}
if (spreadCashflowCharacteristics.NeedForecast1Forecast2Correlation)
{
if (fForecastCurrency == fForecast2Currency)
{
// correl between forecast rates in same currency
fForecast1Forecast2Correls = factors.Get<CMSRateCorrelations>(fForecastCurrency);
}
else
{
fForecast1Forecast2Correl = CorrelationHelper.Get(factors, typeof(InterestRate), fForecastCurrency, null, typeof(InterestRate), fForecast2Currency, null);
}
}
}
/// <summary>
/// Value the deal.
/// </summary>
/// <param name="pv">Present value to be updated.</param>
/// <param name="cash">Realised cash to be updated.</param>
/// <param name="baseDate">Base date of the calculation.</param>
/// <param name="valueDate">Valuation date.</param>
/// <param name="intraValuationDiagnosticsWriter">Cashflow writer.</param>
public override void Value(Vector pv, Vector cash, double baseDate, double valueDate, ISACCRResult saccrResult,
IIntraValuationDiagnosticsWriter intraValuationDiagnosticsWriter)
{
// pv -> fBuySellSign * (fBuySellSign * pv + cashflowListPv) = pv + fBuySellSign * cashflowListPv
ApplySign(pv, cash, fBuySellSign);
fCashflows.Value(pv, cash, baseDate, valueDate, fDiscountRate, fForecastRate, fForecastRate2, fDiscountRateVol,
fDiscountYieldVol, fForecast1RateVol, fForecast1YieldVol, fForecast2RateVol, fForecast2YieldVol, fFx1Vol, fFx2Vol,
fForecast1Fx1Correl, fForecast2Fx2Correl, fForecast1DiscountCorrel, fForecast2DiscountCorrel,
fForecast1Forecast2Correl, fForecast1Forecast2Correls, fCutoffDate);
ApplySign(pv, cash, fBuySellSign);
}
/// <summary>
/// Collect cashflows realised along the scenario path up to endDate.
/// </summary>
public override void CollectCashflows(CashAccumulators cashAccumulators, double baseDate, double endDate)
{
fCashflows.CollectCashflows(cashAccumulators, fFxRate, baseDate, endDate, fBuySellSign, fForecastRate, fForecastRate2, fCutoffDate);
}
/// <summary>
/// Returns true if this model can value deals with forecast rate currency different from settlement currency.
/// </summary>
protected override bool SupportQuanto()
{
return true;
}
/// <summary>
/// Warn of unnecessary volatility surface definitions.
/// </summary>
/// <remarks>
/// Test differently if the cap and swaption volatility definitions are the same or
/// distinct because they may have been set by a single property or two distinct ones.
/// </remarks>
private static void ValidateUnnecessaryVolatilities(CFGeneralInterestSpreadListDeal deal, SpreadCashflowListCharacteristics characteristics, ErrorList errors)
{
if (deal.Discount_Rate_Cap_Volatility == deal.Discount_Rate_Swaption_Volatility)
{
if (!characteristics.NeedDiscountRateVol && !characteristics.NeedDiscountYieldVol && !string.IsNullOrEmpty(deal.Discount_Rate_Cap_Volatility))
deal.AddToErrors(errors, ErrorLevel.Info, $"Unnecessary {nameof(deal.Discount_Rate_Cap_Volatility)} and {nameof(deal.Discount_Rate_Swaption_Volatility)} {deal.Discount_Rate_Cap_Volatility}");
}
else
{
if (!characteristics.NeedDiscountRateVol && !string.IsNullOrEmpty(deal.Discount_Rate_Cap_Volatility))
deal.AddToErrors(errors, ErrorLevel.Info, $"Unnecessary {nameof(deal.Discount_Rate_Cap_Volatility)} {deal.Discount_Rate_Cap_Volatility}");
if (!characteristics.NeedDiscountYieldVol && !string.IsNullOrEmpty(deal.Discount_Rate_Swaption_Volatility))
deal.AddToErrors(errors, ErrorLevel.Info, $"Unnecessary {nameof(deal.Discount_Rate_Swaption_Volatility)} {deal.Discount_Rate_Swaption_Volatility}");
}
if (deal.Forecast_Rate1_Cap_Volatility == deal.Forecast_Rate1_Swaption_Volatility)
{
if (!characteristics.NeedForecast1RateVol && !characteristics.NeedForecast1YieldVol && !string.IsNullOrEmpty(deal.Forecast_Rate1_Cap_Volatility))
deal.AddToErrors(errors, ErrorLevel.Info, $"Unnecessary {nameof(deal.Forecast_Rate1_Cap_Volatility)} and {nameof(deal.Forecast_Rate1_Swaption_Volatility)} {deal.Forecast_Rate1_Cap_Volatility}.");
}
else
{
if (!characteristics.NeedForecast1RateVol && !string.IsNullOrEmpty(deal.Forecast_Rate1_Cap_Volatility))
deal.AddToErrors(errors, ErrorLevel.Info, $"Unnecessary {nameof(deal.Forecast_Rate1_Cap_Volatility)} {deal.Forecast_Rate1_Cap_Volatility}.");
if (!characteristics.NeedForecast1YieldVol && !string.IsNullOrEmpty(deal.Forecast_Rate1_Swaption_Volatility))
deal.AddToErrors(errors, ErrorLevel.Info, $"Unnecessary {nameof(deal.Forecast_Rate1_Swaption_Volatility)} {deal.Forecast_Rate1_Swaption_Volatility}.");
}
if (deal.Forecast_Rate2_Cap_Volatility == deal.Forecast_Rate2_Swaption_Volatility)
{
if (!characteristics.NeedForecast2RateVol && !characteristics.NeedForecast2YieldVol && !string.IsNullOrEmpty(deal.Forecast_Rate2_Cap_Volatility))
deal.AddToErrors(errors, ErrorLevel.Info, $"Unnecessary {nameof(deal.Forecast_Rate2_Cap_Volatility)} and {nameof(deal.Forecast_Rate2_Swaption_Volatility)} {deal.Forecast_Rate2_Cap_Volatility}.");
}
else
{
if (!characteristics.NeedForecast2RateVol && !string.IsNullOrEmpty(deal.Forecast_Rate2_Cap_Volatility))
deal.AddToErrors(errors, ErrorLevel.Info, $"Unnecessary {nameof(deal.Forecast_Rate2_Cap_Volatility)} {deal.Forecast_Rate2_Cap_Volatility}.");
if (!characteristics.NeedForecast2YieldVol && !string.IsNullOrEmpty(deal.Forecast_Rate2_Swaption_Volatility))
deal.AddToErrors(errors, ErrorLevel.Info, $"Unnecessary {nameof(deal.Forecast_Rate2_Swaption_Volatility)} {deal.Forecast_Rate2_Swaption_Volatility}.");
}
}
}
}