// Risk of a vanilla swap with respect discounting and forwarding curves (it works only for multi-curve) object IRate.SwapRisk(string idCode, double Rate, string SwapTenor, bool PayOrRec, double Nominal, double shift, int caseSwitch) { // Get Fwd Start Swap according to underlying rate floating tenor used in building carve (es 3m or 6m,..) if (m_xlApp != null) { m_xlApp.Volatile(true); } try { IMultiRateCurve MultiCurve = null; // initialise a multi curve if (MCDictionary.TryGetValue(idCode, out MultiCurve)) // is the idCode in dictionary? { object OutPut = null; VanillaSwap swap = new VanillaSwap(MultiCurve, Rate, SwapTenor, PayOrRec, Nominal); switch (caseSwitch) { case 1: OutPut = (double[])swap.BPVShiftedDCurve(shift); break; case 2: OutPut = (double)swap.BPVParallelShiftDCurve(shift); break; case 3: OutPut = (double[])swap.BPVShiftedFwdCurve(shift); break; case 4: OutPut = (double)swap.BPVParallelShiftFwdCurve(shift); break; default: return(0); // break; } return(OutPut); } else { return("Curve not found"); // curve not found } } catch (Exception e) { return((string)e.ToString()); } }