Exemple #1
0
    // Specification for this class
    public override void LoadSpecifications()
    {
        // Basis swap 6m vs 3m
        this.buildingBlockType = BuildingBlockType.EURSWAP3M;

        // Fixed leg details on swapLeg1
        Rule   FloatSwapRule1          = Rule.Backward;
        string FloatSwapPayFreqString1 = "6m";
        BusinessDayAdjustment FloatSwapBusDayAdjRolls1 = BusinessDayAdjustment.ModifiedFollowing;
        string FloatSwapLegPaymentString1            = "0d";
        BusinessDayAdjustment FloatSwapBusDayAdjPay1 = BusinessDayAdjustment.ModifiedFollowing;
        Dc       FloatDayCount1            = Dc._Act_360; // day count of Floating leg
        FixFloat FloatFixOrFloat1          = FixFloat.Floating;
        string   FloatUnderlyingRateTenor1 = "6m";

        // Floating details on Leg2
        Rule   FloatSwapRule2          = Rule.Backward;
        string FloatSwapPayFreqString2 = "3m";
        BusinessDayAdjustment FloatSwapBusDayAdjRolls2 = BusinessDayAdjustment.ModifiedFollowing;
        string FloatSwapLegPaymentString2            = "0d";
        BusinessDayAdjustment FloatSwapBusDayAdjPay2 = BusinessDayAdjustment.ModifiedFollowing;
        Dc       FloatDayCount2            = Dc._Act_360; // day count of Floating leg
        FixFloat FloatFixOrFloat2          = FixFloat.Floating;
        string   FloatUnderlyingRateTenor2 = "3m";

        // Creating swap legs
        // create swapLeg1
        this.swapLeg1 = new SwapLeg(FloatSwapRule1, FloatSwapPayFreqString1, FloatSwapBusDayAdjRolls1,
                                    FloatSwapLegPaymentString1, FloatSwapBusDayAdjPay1, FloatDayCount1, FloatFixOrFloat1, FloatUnderlyingRateTenor1);
        // create swapLeg2
        this.swapLeg2 = new SwapLeg(FloatSwapRule2, FloatSwapPayFreqString2, FloatSwapBusDayAdjRolls2,
                                    FloatSwapLegPaymentString2, FloatSwapBusDayAdjPay2, FloatDayCount2, FloatFixOrFloat2, FloatUnderlyingRateTenor2);
    }
Exemple #2
0
    // Specification for this class
    public override void LoadSpecifications()
    {
        // standard EoniaSwap Data may be stored on xml
        this.buildingBlockType = BuildingBlockType.EONIASWAP;

        // Fixed leg details on swapLeg1
        Rule   FixSwapRule          = Rule.Backward;
        string FixSwapPayFreqString = "1y";
        BusinessDayAdjustment FixSwapBusDayAdjRolls = BusinessDayAdjustment.ModifiedFollowing;
        string FixSwapLegPaymentString            = "1d";
        BusinessDayAdjustment FixSwapBusDayAdjPay = BusinessDayAdjustment.ModifiedFollowing;
        Dc       FixDayCount            = Dc._Act_360; // day count of fixed leg
        FixFloat FixFixOrFloat          = FixFloat.Fixed;
        string   FixUnderlyingRateTenor = "";

        // Floating details on Leg2
        Rule   FloatSwapRule          = Rule.Backward;
        string FloatSwapPayFreqString = "1y";
        BusinessDayAdjustment FloatSwapBusDayAdjRolls = BusinessDayAdjustment.ModifiedFollowing;
        string FloatSwapLegPaymentString            = "1d";
        BusinessDayAdjustment FloatSwapBusDayAdjPay = BusinessDayAdjustment.ModifiedFollowing;
        Dc       FloatDayCount            = Dc._Act_360; // day count of Floating leg
        FixFloat FloatFixOrFloat          = FixFloat.Floating;
        string   FloatUnderlyingRateTenor = "1d";

        // Creating swap legs
        // create swapLeg1
        this.swapLeg1 = new SwapLeg(FixSwapRule, FixSwapPayFreqString, FixSwapBusDayAdjRolls,
                                    FixSwapLegPaymentString, FixSwapBusDayAdjPay, FixDayCount, FixFixOrFloat, FixUnderlyingRateTenor);
        // create swapLeg2
        this.swapLeg2 = new SwapLeg(FloatSwapRule, FloatSwapPayFreqString, FloatSwapBusDayAdjRolls,
                                    FloatSwapLegPaymentString, FloatSwapBusDayAdjPay, FloatDayCount, FloatFixOrFloat, FloatUnderlyingRateTenor);
    }
    FixFloat fixedFloating;                   // Fix or Floating

    // constructor
    public BaseSwapLeg(Rule SwapScheduleGeneratorRule, string PayFreq, BusinessDayAdjustment SwapBusDayRollsAdj,
                       string SwapLagPayment, BusinessDayAdjustment SwapBusDayPayAdj, Dc DayCount, FixFloat FixedFloating)
    {
        // assign to data member
        this.swapScheduleGeneratorRule = SwapScheduleGeneratorRule;
        this.payFreq            = PayFreq;
        this.swapBusDayRollsAdj = SwapBusDayRollsAdj;
        this.swapLagPayment     = SwapLagPayment;
        this.swapBusDayPayAdj   = SwapBusDayPayAdj;
        this.dayCount           = DayCount;
        this.fixedFloating      = FixedFloating;
    }
    string underlyingRateTenor;               // underlying rate tenor

    // Constructor
    public SwapLeg(Rule SwapScheduleGeneratorRule, string PayFreq, BusinessDayAdjustment SwapBusDayRollsAdj,
                   string SwapLagPayment, BusinessDayAdjustment SwapBusDayPayAdj, Dc DayCount, FixFloat FixedFloating, string UnderlyingRateTenor)
    {
        // If leg is fixed the underlying floating rate tenor should be blank
        if ((FixedFloating == FixFloat.Fixed) && (UnderlyingRateTenor != ""))
        {
            throw new ArgumentException("error UnderlyingRateTenor must be blank for fixed leg");
        }

        // Assign to data member
        this.swapScheduleGeneratorRule = SwapScheduleGeneratorRule;
        this.payFreq             = PayFreq;
        this.swapBusDayRollsAdj  = SwapBusDayRollsAdj;
        this.swapLagPayment      = SwapLagPayment;
        this.swapBusDayPayAdj    = SwapBusDayPayAdj;
        this.dayCount            = DayCount;
        this.fixedFloating       = FixedFloating;
        this.underlyingRateTenor = UnderlyingRateTenor;
    }