bool CompareLegs(Leg leg1, Leg leg2, MurexProduct murex, bool isFloatFloat, bool fullMatch, bool sameRef, ref string unmatchReason, DateTime dt) { var date = new SimpleDate(dt); var time = dt; if (leg1.NotionalCurrency != murex.Currency1) { if (!sameRef) return false; else unmatchReason += "Currency1 "; } if (leg2.NotionalCurrency != murex.Currency2) { if (!sameRef) return false; else unmatchReason += "Currency2 "; } if (leg1.StartDate != murex.EffectiveDate && leg1.FirstCalculationPeriodStart != murex.EffectiveDate) { if (!sameRef) return false; else unmatchReason += "SwapStartDate "; } if (leg1.EndDate != murex.EndDate) { if (!sameRef) return false; else unmatchReason += "SwapEndDate "; } if (Math.Abs(leg1.CurrentNominal(date, time, false) - murex.Nominal1) > _qtyTolerance) { if (fullMatch) return false; else unmatchReason += "Nominal1 "; } if (Math.Abs(leg2.CurrentNominal(date, time, false) - murex.Nominal2) > _qtyTolerance) { if (fullMatch) return false; else unmatchReason += "Nominal2 "; } if (!isFloatFloat && Math.Abs(leg1.FixedRate - murex.FixedRate) > _rateTolerance) { if (fullMatch) return false; else unmatchReason += "FixedRate "; } if (Math.Abs(leg2.Spread - murex.Spread2) > _rateTolerance) { if (fullMatch) return false; else unmatchReason += "Spread2 "; } if (leg2.FirstFixing != 0 && Math.Abs(leg2.FirstFixing - murex.FirstFixingRate2) > _rateTolerance) { if (fullMatch) return false; else unmatchReason += "FirstFixing2 "; } if (isFloatFloat) { if (Math.Abs(leg1.Spread - murex.Spread1) > _rateTolerance) { if (fullMatch) return false; else unmatchReason += "Spread1 "; } if (leg1.FirstFixing != 0 && Math.Abs(leg1.FirstFixing - murex.FirstFixingRate1) > _rateTolerance) { if (fullMatch) return false; else unmatchReason += "FirstFixing1 "; } } return true; }