Exemplo n.º 1
0
        public IrSwap(FloatLeg floatLeg, FixedLeg fixedLeg, int tradeSign)
        {
            FloatLeg = floatLeg;
            FixedLeg = fixedLeg;

            if (tradeSign == 1 || tradeSign == -1)
            {
                TradeSign = tradeSign;
            }
            else
            {
                throw new InvalidOperationException("TradeSign has to be 1 (pay fixed) or -1 (pay float)");
            }
        }
Exemplo n.º 2
0
        public TenorBasisSwap(FloatLeg floatLegSpread, FloatLeg floatLegNoSpread, int tradeSign)
        {
            this.FloatLegNoSpread = floatLegNoSpread.Copy();
            this.FloatLegSpread   = floatLegSpread.Copy();

            // Construct default FixedLeg - quick and dirty
            FixedLeg tempFixedLeg = new FixedLeg(floatLegNoSpread.AsOf, floatLegSpread.StartDate, floatLegSpread.EndDate, 0.01, CurveTenor.Fwd1Y, DayCount.THIRTY360, DayRule.MF, floatLegSpread.Notional);

            SwapSpread   = new IrSwap(floatLegSpread, tempFixedLeg, tradeSign);
            SwapNoSpread = new IrSwap(floatLegNoSpread, tempFixedLeg, -1 * tradeSign);

            TradeSign = tradeSign;
            CheckTradeSign();

            ConstructedFromFloatingLegs = true;
        }
Exemplo n.º 3
0
        public IrSwap(DateTime asOf, DateTime startDate, DateTime endDate, double fixedRate,
                      CurveTenor fixedFreq, CurveTenor floatFreq, DayCount fixedDayCount, DayCount floatDayCount,
                      DayRule fixedDayRule, DayRule floatDayRule, double notional, int tradeSign, double spread = 0.0)
        {
            FloatLeg = new FloatLeg(asOf, startDate, endDate, floatFreq, floatDayCount, floatDayRule, notional, spread);
            FixedLeg = new FixedLeg(asOf, startDate, endDate, fixedRate, fixedFreq, fixedDayCount, fixedDayRule, notional);

            if (tradeSign == 1 || tradeSign == -1)
            {
                TradeSign = tradeSign;
            }
            else
            {
                throw new InvalidOperationException("TradeSign has to be 1 (pay fixed) or -1 (pay float)");
            }
        }
Exemplo n.º 4
0
        public ADouble ValueFixedLegAD(FixedLeg FixedLeg)
        {
            ADouble FixedAnnuity = AnnuityAD(FixedLeg.Schedule, Interpolation);

            return(FixedLeg.FixedRate * FixedAnnuity * FixedLeg.Notional);
        }