コード例 #1
0
        /* Functions below are the actual functions used to
         * parse instrument strings into actual objects. We've created
         * a method for each of the instrument classes we consider.
         * Note that the string has to have a very specific format.
         */

        private void InterpretTenorBasisSwapString(string instrumentString)
        {
            string identifier, type, currency, swapNoSpreadIdent, swapSpreadIdent;

            string[] infoArray = instrumentString.Split(',').ToArray();

            identifier = infoArray[0];
            type       = infoArray[1];
            currency   = infoArray[2];

            // In accordance with market practice, we put the spread on the short leg
            swapSpreadIdent   = infoArray[3];
            swapNoSpreadIdent = infoArray[4];

            try
            {
                IrSwap         swapNoSpread = IrSwaps[swapNoSpreadIdent];
                IrSwap         swapSpread   = IrSwaps[swapSpreadIdent];
                TenorBasisSwap swap         = new TenorBasisSwap(swapSpread, swapNoSpread, _defaultTradeSign);
                BasisSwaps[identifier] = swap;
                DateTime curvePoint = swap.GetCurvePoint();
                CurvePointMap[identifier]           = swap.GetCurvePoint();
                InstrumentTypeMap[identifier]       = QuoteType.ParBasisSpread;
                InstrumentFormatTypeMap[identifier] = InstrumentFormatType.BasisSpreads;
                IdentifierStringMap[identifier]     = instrumentString;
            }
            catch
            {
                // Ignore instrument
            }
        }
コード例 #2
0
ファイル: LinearRateADD.cs プロジェクト: finukan/MasterThesis
        public ADouble ParBasisSpreadTwoLegsAD(TenorBasisSwap swap)
        {
            ADouble pvNoSpread    = ValueFloatLegNoSpreadAD(swap.FloatLegNoSpread) / swap.FloatLegNoSpread.Notional;
            ADouble pvSpread      = ValueFloatLegNoSpreadAD(swap.FloatLegSpread) / swap.FloatLegSpread.Notional;
            ADouble annuitySpread = AnnuityAD(swap.FloatLegSpread.Schedule, Interpolation);

            return((pvNoSpread - pvSpread) / annuitySpread);
        }
コード例 #3
0
        public static void BasisSwap_Make(string baseName, string floatLegNoSpreadName, string floatLegSpreadName, int tradeSign)
        {
            FloatLeg       floatLegNoSpread = ObjectMap.FloatLegs[floatLegNoSpreadName];
            FloatLeg       floatLegSpread   = ObjectMap.FloatLegs[floatLegSpreadName];
            TenorBasisSwap swap             = new MasterThesis.TenorBasisSwap(floatLegSpread, floatLegNoSpread, tradeSign);

            ObjectMap.LinearRateInstruments[baseName] = swap;
            ObjectMap.BasisSwaps[baseName]            = swap;
        }
コード例 #4
0
ファイル: LinearRateADD.cs プロジェクト: finukan/MasterThesis
        public ADouble ParBasisSpreadTwoIrsAD(TenorBasisSwap swap)
        {
            // Tedious way
            //ADouble pvNoSpread = ValueFloatLegNoSpreadAD(swap.FloatLegNoSpread) / swap.FloatLegNoSpread.Notional;
            //ADouble pvSpread = ValueFloatLegNoSpreadAD(swap.FloatLegSpread) / swap.FloatLegSpread.Notional;
            //ADouble annuityOfSpreadFixedLeg = AnnuityAD(swap.FloatLegSpread.Schedule, Interpolation);
            //ADouble annuityOfNoSpreadFixedLeg = AnnuityAD(swap.FloatLegNoSpread.Schedule, Interpolation);
            //return pvNoSpread / annuityOfNoSpreadFixedLeg - pvSpread / annuityOfSpreadFixedLeg;

            return(IrParSwapRateAD(swap.SwapNoSpread) - IrParSwapRateAD(swap.SwapSpread));
        }
コード例 #5
0
ファイル: LinearRateADD.cs プロジェクト: finukan/MasterThesis
 public ADouble ParBasisSpreadAD(TenorBasisSwap swap)
 {
     if (swap.ConstructedFromFloatingLegs)
     {
         return(ParBasisSpreadTwoLegsAD(swap));
     }
     else
     {
         return(ParBasisSpreadTwoIrsAD(swap));
     }
 }
コード例 #6
0
ファイル: LinearRateADD.cs プロジェクト: finukan/MasterThesis
 // Tenor basis swaps
 public ADouble BasisSwapNpvAD(TenorBasisSwap swap)
 {
     if (swap.ConstructedFromFloatingLegs)
     {
         return(BasisSwapNpvTwoLegsAD(swap));
     }
     else
     {
         return(BasisSwapNpvTwoIrsAD(swap));
     }
 }
コード例 #7
0
ファイル: LinearRateADD.cs プロジェクト: finukan/MasterThesis
 public ADouble BasisSwapNpvTwoIrsAD(TenorBasisSwap swap)
 {
     return(ValueLinearRateProductAD(swap.SwapNoSpread) - ValueLinearRateProductAD(swap.SwapSpread));
 }
コード例 #8
0
ファイル: LinearRateADD.cs プロジェクト: finukan/MasterThesis
 public ADouble BasisSwapNpvTwoLegsAD(TenorBasisSwap swap)
 {
     return((double)swap.TradeSign * (ValueFloatLegAD(swap.FloatLegNoSpread) - ValueFloatLegAD(swap.FloatLegSpread)));
 }
コード例 #9
0
 public double BasisSwapNpvTwoLegs(TenorBasisSwap swap)
 {
     return(swap.TradeSign * (ValueFloatLeg(swap.FloatLegNoSpread) - ValueFloatLeg(swap.FloatLegSpread)));
 }