public void GetPrice2Vanilla() { DateTime valuationDate = DateTime.Today; var irCapFloorPricer = new CapFloorPricer(); var curveId = BuildAndCacheRateCurve(valuationDate); foreach (CapFloorType capFloorType in new[] { CapFloorType.Cap, CapFloorType.Floor }) { Debug.Print("Type: {0}", capFloorType); CapFloorLegParametersRange_Old capLeg = GetCapFloorInputParameters(valuationDate, valuationDate.AddMonths(6), valuationDate.AddYears(5), capFloorType, "Standard", curveId, curveId); ValuationRange valuationRange = CreateValuationRangeForNAB(valuationDate); List <DateTimeDoubleRangeItem> notional = GetAmortNotional(capLeg, 3); List <DetailedCashflowRangeItem> cashflowList = irCapFloorPricer.GetDetailedCashflowsWithNotionalSchedule(Engine.Logger, Engine.Cache, Engine.NameSpace, null, null, capLeg, notional, valuationRange); TradeRange tradeRange = null; var leg1BulletPaymentList = new List <AdditionalPaymentRangeItem>(); List <FeePaymentRangeItem> feePaymentRangeItems = GetFeeList("counterparty", "book"); // Get price and swap representation using non-vanilla PRICE function. // var newCashflowList = cashflowList.Cast <InputCashflowRangeItem>().ToList(); Pair <ValuationResultRange, CapFloor> nonVanillaPriceImpl = CapFloorPricer.GetPriceAndGeneratedFpML(Engine.Logger, Engine.Cache, Engine.NameSpace, null, null, valuationRange, tradeRange, capLeg, newCashflowList, null, leg1BulletPaymentList, feePaymentRangeItems); // NO PExs // CollectionAssertExtension.IsEmpty(nonVanillaPriceImpl.Second.capFloorStream.cashflows.principalExchange); // No payments // CollectionAssertExtension.IsEmpty(nonVanillaPriceImpl.Second.additionalPayment); Debug.Print(ValuationResultRangeToString(nonVanillaPriceImpl.First)); } }
public void CreateValuationVanilla() { DateTime valuationDate = DateTime.Today; var irCapFloorPricer = new CapFloorPricer(); var curveId = BuildAndCacheRateCurve(valuationDate); foreach (CapFloorType capFloorType in new[] { CapFloorType.Cap, CapFloorType.Floor }) { Debug.Print("Type: {0}", capFloorType); CapFloorLegParametersRange_Old capLeg = GetCapFloorInputParameters(valuationDate, valuationDate.AddMonths(6), valuationDate.AddYears(5), capFloorType, "Standard", curveId, curveId); ValuationRange valuationRange = CreateValuationRangeForNAB(valuationDate); List <DateTimeDoubleRangeItem> notional = GetAmortNotional(capLeg, 3); List <DetailedCashflowRangeItem> cashflowList = irCapFloorPricer.GetDetailedCashflowsWithNotionalSchedule(Engine.Logger, Engine.Cache, Engine.NameSpace, null, null, capLeg, notional, valuationRange); switch (capFloorType) { case CapFloorType.Cap: cashflowList[0].CouponType = "cap"; // that should test case insensitive nature of the coupons cashflowList[1].CouponType = "Cap"; // break; case CapFloorType.Floor: cashflowList[0].CouponType = "floor"; // that should test case insensitive nature of the coupons cashflowList[1].CouponType = "Floor"; // break; default: throw new ArgumentOutOfRangeException(); } var tradeRange = new TradeRange { TradeDate = DateTime.Now }; var leg1BulletPaymentList = new List <AdditionalPaymentRangeItem>(); var newCashflowList = cashflowList.Cast <InputCashflowRangeItem>().ToList(); // Get price and swap representation using non-vanilla PRICE function. // List <StringObjectRangeItem> valuationSetList = CreateValuationSetList2(1111, 12); List <PartyIdRangeItem> partyList = GetPartyList("NAB", "book", "MCHammer", "counterparty"); List <OtherPartyPaymentRangeItem> otherPartyPaymentRangeItems = GetOtherPartyPaymentList("counterparty", "cost center"); List <FeePaymentRangeItem> feePaymentRangeItems = GetFeeList("counterparty", "book"); string id = irCapFloorPricer.CreateValuation(Engine.Logger, Engine.Cache, Engine.NameSpace, null, null, valuationSetList, valuationRange, tradeRange, capLeg, newCashflowList, null, leg1BulletPaymentList, partyList, otherPartyPaymentRangeItems, feePaymentRangeItems); var valuationReport = Engine.Cache.LoadObject <ValuationReport>(Engine.NameSpace + "." + id); Debug.Print(XmlSerializerHelper.SerializeToString(valuationReport)); } }
public void GetDetailedCapFloorCashflowsVanilla() { DateTime valuationDate = DateTime.Today; var irCapFloorPricer = new CapFloorPricer(); var curveId = BuildAndCacheRateCurve(valuationDate); foreach (CapFloorType legType in new[] { CapFloorType.Cap, CapFloorType.Floor }) { Debug.Print("LegType: {0}", legType); CapFloorLegParametersRange_Old capLeg = GetCapFloorInputParameters(valuationDate, valuationDate.AddMonths(6), valuationDate.AddYears(5), legType, "Standard", curveId, curveId); ValuationRange valuationRange = CreateValuationRange(valuationDate); List <DateTimeDoubleRangeItem> notional = GetAmortNotional(capLeg, 3); List <DetailedCashflowRangeItem> cashflowList = irCapFloorPricer.GetDetailedCashflowsWithNotionalSchedule(Engine.Logger, Engine.Cache, Engine.NameSpace, null, null, capLeg, notional, valuationRange); object[,] arrayOfCashflows = ObjectToArrayOfPropertiesConverter.ConvertListToHorizontalArrayRange(cashflowList); Debug.WriteLine("Cashflows:"); Debug.WriteLine(ParameterFormatter.FormatObject(arrayOfCashflows)); } }
public static object[,] DoXLReport(CapFloorPricer capFloor, bool receiveLeg) { if (capFloor != null) { var result = new object[capFloor.CapFloorLeg.Coupons.Count, 6]; if (receiveLeg) { var index = 0; foreach (var receiveRateCoupon in capFloor.CapFloorLeg.Coupons) { result[index, 0] = "ReceiveLeg_Coupon_" + index; result[index, 1] = receiveRateCoupon.PriceableCouponType.ToString(); result[index, 2] = receiveRateCoupon.PaymentDate; result[index, 3] = receiveRateCoupon.NotionalAmount.amount; result[index, 4] = receiveRateCoupon.Rate; result[index, 5] = receiveRateCoupon.PaymentAmount.amount; index++; } } } return(null); }
/// <summary> /// /// </summary> /// <param name="logger"></param> /// <param name="cache"></param> /// <param name="nameSpace"></param> /// <param name="legCalendars"></param> /// <param name="trade"></param> /// <param name="tradeProps"></param> /// <param name="forecastRateInterpolation"></param> public TradePricer(ILogger logger, ICoreCache cache, String nameSpace, List <Pair <IBusinessCalendar, IBusinessCalendar> > legCalendars, Trade trade, NamedValueSet tradeProps, bool forecastRateInterpolation) { if (tradeProps == null) { tradeProps = new NamedValueSet();//TODO Need to generate properties for the FpML examples. } var tradeIdentifier = new TradeIdentifier(tradeProps); TradeIdentifier = tradeIdentifier; TradeHeader = trade.tradeHeader; //Get the baseParty, which in GWML is the originating party. BaseParty = tradeProps.GetValue <string>(TradeProp.BaseParty, false) ?? TradeProp.Party1; var party1 = tradeProps.GetValue <string>(TradeProp.Party1, true); var party2 = tradeProps.GetValue <string>(TradeProp.Party2, true); Parties = new List <Party> { new Party { partyName = new PartyName { Value = party1 } }, new Party { partyName = new PartyName { Value = party2 } } }; TradeType = trade.ItemElementName; //Determine the product type, so that the appropriate productPricer can be instantiated. //Set the product type var productType = tradeIdentifier.ProductType; //Check whether the business calendars list is null. Pair <IBusinessCalendar, IBusinessCalendar> firstCalendarPair = null; if (legCalendars?.Count > 0) { firstCalendarPair = legCalendars[0]; } //Instantiate the productPricer. if (productType != null && productType != ProductTypeSimpleEnum.Undefined) { ProductType = (ProductTypeSimpleEnum)productType; switch (ProductType) { case ProductTypeSimpleEnum.PropertyTransaction: { IBusinessCalendar settlementCalendar = null; if (firstCalendarPair != null) { settlementCalendar = firstCalendarPair.First; } var property = (PropertyTransaction)trade.Item; var tradeDate = tradeProps.GetValue <DateTime>(TradeProp.TradeDate, false); var referenceProperty = tradeProps.GetValue <String>(PropertyProp.ReferenceProperty, false); //Get the instrument configuration data. //Modify the pricer to include this data. PriceableProduct = new PropertyTransactionPricer(logger, cache, nameSpace, tradeDate, referenceProperty, settlementCalendar, property, BaseParty, forecastRateInterpolation); ProductReporter = new PropertyTransactionReporter(); } break; case ProductTypeSimpleEnum.EquityTransaction: { IBusinessCalendar settlementCalendar = null; if (firstCalendarPair != null) { settlementCalendar = firstCalendarPair.First; } var equity = (EquityTransaction)trade.Item; var tradeDate = tradeProps.GetValue <DateTime>(TradeProp.TradeDate, true); var effectiveDate = tradeProps.GetValue <DateTime>(TradeProp.EffectiveDate, true); var referenceEquity = tradeProps.GetValue <String>(EquityProp.ReferenceEquity, false); //Get the instrument configuration data. //Modify the pricer to include this data. PriceableProduct = new EquityTransactionPricer(logger, cache, nameSpace, tradeDate, effectiveDate, referenceEquity, settlementCalendar, equity, BaseParty, forecastRateInterpolation); ProductReporter = new EquityTransactionReporter(); } break; case ProductTypeSimpleEnum.BondTransaction: { IBusinessCalendar settlementCalendar = null; if (firstCalendarPair != null) { settlementCalendar = firstCalendarPair.First; } var bond = (BondTransaction)trade.Item; var tradeDate = tradeProps.GetValue <DateTime>(TradeProp.TradeDate, true); var effectiveDate = tradeProps.GetValue <DateTime>(TradeProp.EffectiveDate, true); var bondType = tradeProps.GetValue <string>(BondProp.BondType, false); //Get the instrument configuration data. //Modify the pricer to include this data. PriceableProduct = new BondTransactionPricer(logger, cache, nameSpace, tradeDate, effectiveDate, settlementCalendar, settlementCalendar, bond, BaseParty, bondType, forecastRateInterpolation); ProductReporter = new BondTransactionReporter(); } break; case ProductTypeSimpleEnum.FutureTransaction: { IBusinessCalendar settlementCalendar = null; if (firstCalendarPair != null) { settlementCalendar = firstCalendarPair.First; } var future = (FutureTransaction)trade.Item; var tradeDate = tradeProps.GetValue <DateTime>(TradeProp.TradeDate, false); var type = tradeProps.GetValue <String>(FuturesProp.FuturesType, true); var futureType = EnumHelper.Parse <ExchangeContractTypeEnum>(type); //Get the instrument configuration data. //Modify the pricer to include this data. PriceableProduct = new FutureTransactionPricer(logger, cache, nameSpace, tradeDate, futureType, settlementCalendar, future, BaseParty, forecastRateInterpolation); ProductReporter = new FutureTransactionReporter(); } break; case ProductTypeSimpleEnum.InterestRateSwap: { var swap = (Swap)trade.Item; PriceableProduct = new InterestRateSwapPricer(logger, cache, nameSpace, legCalendars, swap, BaseParty, forecastRateInterpolation); ProductReporter = new InterestRateSwapReporter(); } break; case ProductTypeSimpleEnum.AssetSwap: { var swap = (Swap)trade.Item; //TODO set for the payer. This needs to be modified for the base counterparty. PriceableProduct = new AssetSwapPricer(logger, cache, nameSpace, legCalendars, swap, BaseParty, new Bond(), forecastRateInterpolation); ProductReporter = new InterestRateSwapReporter(); } break; case ProductTypeSimpleEnum.CrossCurrencySwap: { var swap = (Swap)trade.Item; //TODO set for the payer. This needs to be modified for the base counterparty. PriceableProduct = new CrossCurrencySwapPricer(logger, cache, nameSpace, legCalendars, swap, BaseParty, forecastRateInterpolation); ProductReporter = new InterestRateSwapReporter(); } break; case ProductTypeSimpleEnum.FRA: // todo { var fra = (Fra)trade.Item; IBusinessCalendar fixingCalendar = null; IBusinessCalendar paymentCalendar = null; if (firstCalendarPair != null) { fixingCalendar = firstCalendarPair.First; paymentCalendar = firstCalendarPair.Second; } PriceableProduct = new FraPricer(logger, cache, fixingCalendar, paymentCalendar, fra, BaseParty, nameSpace) { ForecastRateInterpolation = forecastRateInterpolation }; ProductReporter = new ForwardRateAgreementReporter(); } break; //case ProductTypeSimpleEnum.InflationSwap: // break; //case ProductTypeSimpleEnum.CreditDefaultSwap: // break; //case ProductTypeSimpleEnum.TotalReturnSwap: // break; //case ProductTypeSimpleEnum.VarianceSwap: // break; case ProductTypeSimpleEnum.CapFloor: { var capFloor = (CapFloor)trade.Item; IBusinessCalendar fixingCalendar = null; IBusinessCalendar paymentCalendar = null; if (firstCalendarPair != null) { fixingCalendar = firstCalendarPair.First; paymentCalendar = firstCalendarPair.Second; } PriceableProduct = new CapFloorPricer(logger, cache, nameSpace, fixingCalendar, paymentCalendar, capFloor, BaseParty); ProductReporter = new CapFloorReporter(); } break; case ProductTypeSimpleEnum.FxSpot: { var fxForward = (FxSingleLeg)trade.Item; PriceableProduct = new FxSingleLegPricer(fxForward, BaseParty, ProductTypeSimpleEnum.FxSpot); ProductReporter = new FxSingleLegReporter(); } break; case ProductTypeSimpleEnum.FxForward: { var fxForward = (FxSingleLeg)trade.Item; PriceableProduct = new FxSingleLegPricer(fxForward, BaseParty, ProductTypeSimpleEnum.FxForward); ProductReporter = new FxSingleLegReporter(); } break; case ProductTypeSimpleEnum.BulletPayment: { if (trade.Item is BulletPayment bullet) { IBusinessCalendar paymentCalendar = null; if (firstCalendarPair != null) { paymentCalendar = firstCalendarPair.Second; } //The calendars if (paymentCalendar == null) { if (bullet.payment.paymentDate != null) { var containsPaymentDateAdjustments = AdjustableOrAdjustedDateHelper.Contains(bullet.payment.paymentDate, ItemsChoiceType.dateAdjustments, out object dateAdjustments); if (containsPaymentDateAdjustments && dateAdjustments != null) { paymentCalendar = BusinessCenterHelper.ToBusinessCalendar(cache, ((BusinessDayAdjustments)dateAdjustments). businessCenters, nameSpace); } } } PriceableProduct = new BulletPaymentPricer(bullet, BaseParty, paymentCalendar); ProductReporter = new BulletPaymentReporter(); } } break; case ProductTypeSimpleEnum.FxSwap: { var fxSwap = (FxSwap)trade.Item; PriceableProduct = new FxSwapPricer(fxSwap, BaseParty); ProductReporter = new FxSwapReporter(); } break; //case ProductTypeSimpleEnum.EquityOption: // break; //case ProductTypeSimpleEnum.BondOption: // break; case ProductTypeSimpleEnum.FxOption: { IBusinessCalendar fixingCalendar = null; IBusinessCalendar paymentCalendar = null; if (firstCalendarPair != null) { fixingCalendar = firstCalendarPair.First; paymentCalendar = firstCalendarPair.Second; } var fxOption = (FxOption)trade.Item; PriceableProduct = new VanillaEuropeanFxOptionPricer(logger, cache, nameSpace, fixingCalendar, paymentCalendar, fxOption, BaseParty); ProductReporter = new FxOptionLegReporter(); } break; //case ProductTypeSimpleEnum.FxOptionStrategy: // break; //case ProductTypeSimpleEnum.CreditDefaultIndex: // break; //case ProductTypeSimpleEnum.CreditDefaultIndexTranche: // break; //case ProductTypeSimpleEnum.CreditDefaultBasket: // break; //case ProductTypeSimpleEnum.CreditDefaultBasketTranche: // break; //case ProductTypeSimpleEnum.CreditDefaultOption: // break; //case ProductTypeSimpleEnum.EquityForward: // break; case ProductTypeSimpleEnum.InterestRateSwaption: { var interestRateSwaption = (Swaption)trade.Item; PriceableProduct = new InterestRateSwaptionPricer(logger, cache, nameSpace, interestRateSwaption, BaseParty, forecastRateInterpolation); ProductReporter = new InterestRateSwaptionReporter(); } break; case ProductTypeSimpleEnum.TermDeposit: { //var party1 = tradeProps.GetValue<string>(TradeProp.Party1, true); //var party2 = tradeProps.GetValue<string>(TradeProp.Party2, true); //var reportingParty = baseParty == party1 ? "Party1" : "Party2"; // TODO this is for backward compatability. var deposit = (TermDeposit)trade.Item; PriceableProduct = new TermDepositPricer(logger, cache, deposit, TradeProp.Party1); //The payment date must be correct before calling this! ProductReporter = new TermDepositReporter(); } break; //case ProductTypeSimpleEnum.DividendSwap: // break; //case ProductTypeSimpleEnum.ConvertibleBondOption: // break; //case ProductTypeSimpleEnum.Loan: // break; //case ProductTypeSimpleEnum.Repo: // break; default: throw new NotSupportedException("Unsupported ProductType: " + ProductType); } } else { switch (TradeType) { case ItemChoiceType15.propertyTransaction: { var equity = (PropertyTransaction)trade.Item; IBusinessCalendar settlementCalendar = null; if (firstCalendarPair != null) { settlementCalendar = firstCalendarPair.First; } var tradeDate = tradeProps.GetValue <DateTime>(TradeProp.TradeDate, false); var referenceProperty = tradeProps.GetValue <String>(PropertyProp.ReferenceProperty, false); PriceableProduct = new PropertyTransactionPricer(logger, cache, nameSpace, tradeDate, referenceProperty, settlementCalendar, equity, BaseParty, forecastRateInterpolation); ProductReporter = new PropertyTransactionReporter(); } break; case ItemChoiceType15.equityTransaction: { var equity = (EquityTransaction)trade.Item; IBusinessCalendar settlementCalendar = null; if (firstCalendarPair != null) { settlementCalendar = firstCalendarPair.First; } var tradeDate = tradeProps.GetValue <DateTime>(TradeProp.TradeDate, false); var effectiveDate = tradeProps.GetValue <DateTime>(TradeProp.EffectiveDate, true); var referenceEquity = tradeProps.GetValue <String>(EquityProp.ReferenceEquity, false); PriceableProduct = new EquityTransactionPricer(logger, cache, nameSpace, tradeDate, effectiveDate, referenceEquity, settlementCalendar, equity, BaseParty, forecastRateInterpolation); ProductReporter = new EquityTransactionReporter(); } break; case ItemChoiceType15.bondTransaction: { var bond = (BondTransaction)trade.Item; IBusinessCalendar settlementCalendar = null; IBusinessCalendar paymentCalendar = null; if (firstCalendarPair != null) { settlementCalendar = firstCalendarPair.First; paymentCalendar = firstCalendarPair.Second; } var tradeDate = tradeProps.GetValue <DateTime>(TradeProp.TradeDate, true); var effectiveDate = tradeProps.GetValue <DateTime>(TradeProp.EffectiveDate, true); var bondType = tradeProps.GetValue <string>(BondProp.BondType, false); PriceableProduct = new BondTransactionPricer(logger, cache, nameSpace, tradeDate, effectiveDate, settlementCalendar, paymentCalendar, bond, BaseParty, bondType, forecastRateInterpolation); ProductReporter = new BondTransactionReporter(); } break; case ItemChoiceType15.futureTransaction: { IBusinessCalendar settlementCalendar = null; if (firstCalendarPair != null) { settlementCalendar = firstCalendarPair.First; } var future = (FutureTransaction)trade.Item; var tradeDate = tradeProps.GetValue <DateTime>(TradeProp.TradeDate, false); var type = tradeProps.GetValue <String>(FuturesProp.FuturesType, true); var futureType = EnumHelper.Parse <ExchangeContractTypeEnum>(type); //Get the instrument configuration data. //Modify the pricer to include this data. PriceableProduct = new FutureTransactionPricer(logger, cache, nameSpace, tradeDate, futureType, settlementCalendar, future, BaseParty, forecastRateInterpolation); ProductReporter = new FutureTransactionReporter(); } break; case ItemChoiceType15.swap: { var swap = (Swap)trade.Item; //TODO this needs to be emnhanced ProductType = ProductTypeSimpleEnum.InterestRateSwap; PriceableProduct = new CrossCurrencySwapPricer(logger, cache, nameSpace, legCalendars, swap, BaseParty, forecastRateInterpolation); ProductReporter = new InterestRateSwapReporter(); //var report = } break; case ItemChoiceType15.fra: // todo { var fra = (Fra)trade.Item; IBusinessCalendar fixingCalendar = null; IBusinessCalendar paymentCalendar = null; if (firstCalendarPair != null) { fixingCalendar = firstCalendarPair.First; paymentCalendar = firstCalendarPair.Second; } ProductType = ProductTypeSimpleEnum.FRA; PriceableProduct = new FraPricer(logger, cache, fixingCalendar, paymentCalendar, fra, BaseParty) { ForecastRateInterpolation = forecastRateInterpolation }; ProductReporter = new ForwardRateAgreementReporter(); } break; case ItemChoiceType15.capFloor: { var capFloor = (CapFloor)trade.Item; IBusinessCalendar fixingCalendar = null; IBusinessCalendar paymentCalendar = null; if (firstCalendarPair != null) { fixingCalendar = firstCalendarPair.First; paymentCalendar = firstCalendarPair.Second; } ProductType = ProductTypeSimpleEnum.CapFloor; PriceableProduct = new CapFloorPricer(logger, cache, nameSpace, fixingCalendar, paymentCalendar, capFloor, BaseParty); ProductReporter = new CapFloorReporter(); } break; case ItemChoiceType15.fxSingleLeg: { var fxForward = (FxSingleLeg)trade.Item; ProductType = ProductTypeSimpleEnum.FxSpot; PriceableProduct = new FxSingleLegPricer(fxForward, BaseParty, ProductType); ProductReporter = new FxSingleLegReporter(); } break; case ItemChoiceType15.fxSwap: { var fxSwap = (FxSwap)trade.Item; ProductType = ProductTypeSimpleEnum.FxSwap; PriceableProduct = new FxSwapPricer(fxSwap, BaseParty); ProductReporter = new FxSwapReporter(); } break; case ItemChoiceType15.bulletPayment: { if (trade.Item is BulletPayment bullet) { IBusinessCalendar paymentCalendar = null; if (firstCalendarPair != null) { paymentCalendar = firstCalendarPair.Second; } //The calendars if (paymentCalendar == null) { if (bullet.payment.paymentDate != null) { var containsPaymentDateAdjustments = AdjustableOrAdjustedDateHelper.Contains(bullet.payment.paymentDate, ItemsChoiceType.dateAdjustments, out object dateAdjustments); if (containsPaymentDateAdjustments && dateAdjustments != null) { paymentCalendar = BusinessCenterHelper.ToBusinessCalendar(cache, ((BusinessDayAdjustments)dateAdjustments). businessCenters, nameSpace); } } } ProductType = ProductTypeSimpleEnum.BulletPayment; PriceableProduct = new BulletPaymentPricer(bullet, BaseParty, paymentCalendar); ProductReporter = new BulletPaymentReporter(); } } break; case ItemChoiceType15.termDeposit: { var deposit = (TermDeposit)trade.Item; ProductType = ProductTypeSimpleEnum.TermDeposit; PriceableProduct = new TermDepositPricer(logger, cache, deposit, TradeProp.Party1); //The payment date must be correct before calling this! ProductReporter = new TermDepositReporter(); } break; case ItemChoiceType15.swaption: { var interestRateSwaption = (Swaption)trade.Item; ProductType = ProductTypeSimpleEnum.InterestRateSwaption; PriceableProduct = new InterestRateSwaptionPricer(logger, cache, nameSpace, interestRateSwaption, BaseParty, forecastRateInterpolation); ProductReporter = new InterestRateSwaptionReporter(); } break; case ItemChoiceType15.fxOption: { IBusinessCalendar fixingCalendar = null; IBusinessCalendar paymentCalendar = null; if (firstCalendarPair != null) { fixingCalendar = firstCalendarPair.First; paymentCalendar = firstCalendarPair.Second; } var fxOption = (FxOption)trade.Item; ProductType = ProductTypeSimpleEnum.FxOption; PriceableProduct = new VanillaEuropeanFxOptionPricer(logger, cache, nameSpace, fixingCalendar, paymentCalendar, fxOption, BaseParty); ProductReporter = new FxOptionLegReporter(); } break; default: throw new NotSupportedException("Unsupported TradeType: " + TradeType); } //Adds the extra party info now required. PriceableProduct.OrderedPartyNames.Add(party1); PriceableProduct.OrderedPartyNames.Add(party2); //Check if collateralised if (trade.collateral != null) { PriceableProduct.IsCollateralised = true; } } }