예제 #1
0
    public static double Swaption(double N, double K, string Start, string SwapTenor, bool isPayer, double sigma, IRateCurve Curve)
    {
        Date refDate = Curve.RefDate();                         // curve ref date
        // false/true with fwd swap matrix
        Date      startDate = refDate.add_period(Start, false); // swap start 2 business days after the expiry
        Date      expDate   = startDate.add_workdays(-2);       // expiry of swaption
        Date      today     = refDate.add_workdays(-2);
        double    T         = today.YF_365(expDate);
        Period    p         = new Period(SwapTenor); // should be in year 1Y, 2Y (not 3m,...)
        SwapStyle y         = (SwapStyle) new BuildingBlockFactory().CreateBuildingBlock(startDate, 0, SwapTenor, Curve.GetSwapStyle().buildingBlockType);

        double[] yf = y.scheduleLeg1.GetYFVect(Dc._30_360);
        double[] df = (from payDay in y.scheduleLeg1.payDates
                       select Curve.Df(payDay)).ToArray();

        return(Swaption(N, Curve.SwapFwd(startDate, SwapTenor), K, sigma, T, isPayer, yf, df));
    }