Пример #1
0
 // At the money forward swap using string args
 object IRate.FwdSwapX(string idCode, string StartTenor, string SwapTenor)
 {
     // make it volatile
     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?
         {
             Date StartDate = MultiCurve.RefDate().add_period(StartTenor, true);
             return(MultiCurve.SwapFwd(new Date(StartDate), SwapTenor));
         }
         else
         {
             return("IdCode not found");  // curve not found
         }
     }
     catch (Exception e)
     {
         return((string)e.ToString());
     }
 }
Пример #2
0
    public VanillaSwap(IMultiRateCurve MultiCurve, double Rate, string SwapTenor, bool PayOrRec, double Nominal)
    {
        // Standard swap
        Type SwapType  = MultiCurve.GetSwapStyle().GetType();
        Date myRefDate = MultiCurve.RefDate();

        // using reflection
        this.mySwap     = (SwapStyle)Activator.CreateInstance(SwapType, myRefDate, Rate, SwapTenor);
        this.payOrRec   = PayOrRec;
        this.multiCurve = MultiCurve;
        this.nominal    = Nominal;
    }