Interest Rate Swap (IRS) Related Functions
About 7 min
Interest Rate Swap (IRS) Related Functions
Visit the Mathema Option Pricing System for foreign exchange options and structured product valuation!
Construction Functions
Excel: =McpVanillaSwap(args1, args2, args3, args4, args5, fmt='VP')
Python: McpVanillaSwap(*args)
- Function: Constructs an Interest Rate Swap (IRS) object.
- Parameters:
args1~args5 or *args: Parameter groups, supporting two input methods:- First Method:
ReferenceDate: Trade date or valuation date.StartDate: Start date (calculated based on the effective date rule).EndDate: End date (calculated based on the start date and tenor).RollDate: Roll date (default equals the start date).FixedPayReceive: Fixed leg payment direction (default isPay).Notional: Notional amount (default is1000000).Coupon: Fixed rate.Margin: Floating leg spread (default is0.0).PaymentCalendar: Holiday calendar object (default is empty).FixedDiscountCurve: Fixed leg discount curve.FixedPaymentFrequency: Fixed leg payment frequency (default isQuarterly).FixedPaymentDateAdjuster: Fixed leg date adjustment rule (default isFollowing).FixedPaymentDayCounter: Fixed leg day count convention (default isAct365Fixed).FloatPaymentFrequency: Floating leg payment frequency (default isQuarterly).FloatPaymentDateAdjuster: Floating leg date adjustment rule (default isFollowing).FloatPaymentDayCounter: Floating leg day count convention (default isAct360).FloatEstimationCurve: Floating leg estimation curve.FloatDiscountCurve: Floating leg discount curve.FixingCalendar: Fixing holiday calendar (default is empty).FixInAdvance: Whether to fix in advance (default isTrue).FixDaysBackward: Days backward for fixing (default is2).FixingRateMethod: Fixing rate calculation method (default isRESETRATE_MAX).HistoryFixingDates: Array of historical fixing dates.HistoryFixingRates: Array of historical fixing rates.FixedExchangeNotional: Fixed leg notional exchange method (default isNOEXCHANGE).FixedResidual: Fixed leg amortization residual (default is0).FixedResidualType: Fixed leg amortization residual type (default isAbsoluteValue).FixedFirstAmortDate: Fixed leg first amortization date.FixedAmortisationType: Fixed leg amortization method (default isAMRT_NONE).FloatExchangeNotional: Floating leg notional exchange method (default isNOEXCHANGE).FloatResidual: Floating leg amortization residual (default is0).FloatResidualType: Floating leg amortization residual type (default isAbsoluteValue).FloatFirstAmortDate: Floating leg first amortization date.FloatAmortisationType: Floating leg amortization method (default isAMRT_NONE).
- Second Method:
SettlementDate: Trade date or valuation date.StartDate: Start date.EndDate: End date.Coupon: Fixed rate.PaymentCalendar: Holiday calendar object (default is empty).FixedFrequency: Fixed leg payment frequency (default isAnnual).FixedDayCounter: Fixed leg day count convention (default isAct365Fixed).FloatingFrequency: Floating leg payment frequency (default isAnnual).FloatingDayCounter: Floating leg day count convention (default isAct365Fixed).FixedEstimationCurve: Fixed leg estimation curve.FixedDiscountCurve: Fixed leg discount curve.FloatingEstimationCurve: Floating leg estimation curve.FloatingDiscountCurve: Floating leg discount curve.FloatingCalendar: Holiday calendar object (default is empty).FirstFixing: First fixing rate.SecondFixing: Second fixing rate.EomRule: End-of-month rule (default is1).CompoundingFrequency: Compounding frequency (default is0).Notional: Notional amount (default is1000000).CsaId: CSA ID.SwapStartLag: Effective date adjustment (default is2).Margin: Floating leg spread.FixedAdjusterRule: Fixed leg adjustment rule (default isModifiedFollowing).FloatAdjusterRule: Floating leg adjustment rule (default isModifiedFollowing).FixedLastOpenday: Fixed leg last open day (default isFalse).FloatLastOpenday: Floating leg last open day (default isFalse).FixedLegPayReceive: Fixed leg payment direction (default isPay).FixInAdvance: Whether to fix in advance (default isTrue).FixDaysBackward: Days backward for fixing (default is2).FixDaysForward: Days forward for fixing (default is2).EndStub: Whether to enable end stub (default isFalse).FixedPayType: Fixed leg payment type (default isInArrears).FloatPayType: Floating leg payment type (default isInArrears).
- First Method:
fmt: Parameter format (default isVP),Excel-specific parameters.
- Returns: Interest Rate Swap object.
The server constructs a VanillaSwap object using an interest rate swap structure.
Excel: =McpVanillaSwaps2(identifiers, enddate, swaprate, point)
- Function: Constructs a VanillaSwap object using an interest rate swap structure on the server side.
- Parameters:
identifiers: The interest rate swap structure.enddate: The end date.enddate: The end date.swaprate: The fixed rate.point: The floating spread, default value is0.
- Returns: A VanillaSwap object for subsequent calculations.
Excel: =McpXCurrencySwap(args1, args2, args3, args4, args5, fmt='VP')
Python: McpXCurrencySwap(*args)
- Function: Constructs a cross-currency swap object.
- Parameters:
args1~args5 or *args: Parameter groups, supporting the following input methods:- First Method:
ReferenceDate: Trade date or valuation date.StartDate: Start date.EndDate: End date.RollDate: Roll date.Notional: Notional amount (default is1000000).BaseSwapLeg: Base currency swap leg object.TermSwapLeg: Target currency swap leg object.BasePayReceive: Base currency payment direction (default isPay).FxRate: Exchange rate.HasInitialExchange: Whether to perform initial notional exchange (default isFalse).HasFinalExchange: Whether to perform final notional exchange (default isFalse).FinalFxRate: Final exchange rate (default is0).
- Second Method:
- Similar to the first method but includes an
FXForwardPointsCurveobject.
- Similar to the first method but includes an
- First Method:
fmt: Parameter format (default isVP),Excel-specific parameters.
- Returns: Cross-currency swap object.
Utility Functions
Excel: =SwapFixedLegNPV(vanillaSwap)
Python: FixedLegNPV()
- Function: Calculates the NPV of the fixed leg.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Fixed leg NPV.
Excel: =SwapFloatingLegNPV(vanillaSwap)
Python: FloatingLegNPV()
- Function: Calculates the NPV of the floating leg.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Floating leg NPV.
Excel: =SwapFixedLegDuration(vanillaSwap)
Python: FixedLegDuration()
- Function: Calculates the duration of the fixed leg.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Fixed leg duration.
Excel: =SwapFloatingLegDuration(vanillaSwap)
Python: FloatingLegDuration()
- Function: Calculates the duration of the floating leg.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Floating leg duration.
Excel: =SwapFixedLegMDuration(vanillaSwap)
Python: FixedLegMDuration()
- Function: Calculates the modified duration of the fixed leg.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Fixed leg modified duration.
Excel: =SwapFloatingLegMDuration(vanillaSwap)
Python: FloatingLegMDuration()
- Function: Calculates the modified duration of the floating leg.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Floating leg modified duration.
Excel: =SwapFixedLegAnnuity(vanillaSwap)
Python: FixedLegAnnuity()
- Function: Calculates the annuity of the fixed leg.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Fixed leg annuity.
Excel: =SwapFloatingLegAnnuity(vanillaSwap)
Python: FloatingLegAnnuity()
- Function: Calculates the annuity of the floating leg.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Floating leg annuity.
Excel: =SwapFixedLegDV01(vanillaSwap)
Python: FixedLegDV01()
- Function: Calculates the DV01 of the fixed leg.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Fixed leg DV01.
Excel: =SwapFloatingLegDV01(vanillaSwap)
Python: FloatingLegDV01()
- Function: Calculates the DV01 of the floating leg.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Floating leg DV01.
Excel: =SwapFixedLegAccrued(vanillaSwap)
Python: FixedLegAccrued()
- Function: Calculates the accrued interest of the fixed leg.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Fixed leg accrued interest.
Excel: =SwapFloatingLegAccrued(vanillaSwap)
Python: FloatingLegAccrued()
- Function: Calculates the accrued interest of the floating leg.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Floating leg accrued interest.
Excel: =SwapFixedLegPremium(vanillaSwap)
Python: FixedLegPremium()
- Function: Calculates the premium of the fixed leg.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Fixed leg premium.
Excel: =SwapFloatingLegPremium(vanillaSwap)
Python: FloatingLegPremium()
- Function: Calculates the premium of the floating leg.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Floating leg premium.
Excel: =SwapFixedLegMarketValue(vanillaSwap)
Python: FixedLegMarketValue()
- Function: Calculates the market value of the fixed leg.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Fixed leg market value.
Excel: =SwapFloatingLegMarketValue(vanillaSwap)
Python: FloatingLegMarketValue()
- Function: Calculates the market value of the floating leg.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Floating leg market value.
Excel: =SwapFixedLegCumPV(vanillaSwap)
Python: FixedLegCumPV()
- Function: Calculates the cumulative present value of the fixed leg.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Fixed leg cumulative present value.
Excel: =SwapFloatingLegCumPV(vanillaSwap)
Python: FloatingLegCumPV()
- Function: Calculates the cumulative present value of the floating leg.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Floating leg cumulative present value.
Excel: =SwapFixedLegCumCF(vanillaSwap)
Python: FixedLegCumCF()
- Function: Calculates the cumulative cash flow of the fixed leg.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Fixed leg cumulative cash flow.
Excel: =SwapFloatingLegCumCF(vanillaSwap)
Python: FloatingLegCumCF()
- Function: Calculates the cumulative cash flow of the floating leg.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Floating leg cumulative cash flow.
Excel: =SwapNPV(vanillaSwap)
Python: NPV()
- Function: Calculates the NPV of the swap.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Swap NPV.
Excel: =SwapMarketParRate(vanillaSwap)
Python: MarketParRate()
- Function: Calculates the par rate of the swap.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Swap par rate.
Excel: =SwapDuration(vanillaSwap)
Python: Duration()
- Function: Calculates the duration of the swap.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Swap duration.
Excel: =SwapMDuration(vanillaSwap)
Python: MDuration()
- Function: Calculates the modified duration of the swap.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Swap modified duration.
Excel: =SwapPV01(vanillaSwap)
Python: PV01()
- Function: Calculates the PV01 of the swap.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Swap PV01.
Excel: =SwapDV01(vanillaSwap)
Python: DV01()
- Function: Calculates the DV01 of the swap.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Swap DV01.
Excel: =SwapCF(vanillaSwap)
Python: CF()
- Function: Calculates the cash flow of the swap.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Swap cash flow.
Excel: =SwapValuationDayCF(vanillaSwap)
Python: ValuationDayCF()
- Function: Calculates the valuation day cash flow of the swap.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Swap valuation day cash flow.
Excel: =SwapMarketValue(vanillaSwap)
Python: MarketValue()
- Function: Calculates the market value of the swap.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Swap market value.
Excel: =SwapAccrued(vanillaSwap)
Python: Accrued()
- Function: Calculates the accrued interest of the swap.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.
- Returns: Swap accrued interest.
Excel: =SwapPNL(vanillaSwap, start, end)
Python: PNL(start, end)
- Function: Calculates the PNL of the swap.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.start: Start date.end: End date.
- Returns: Swap PNL.
Excel: =SwapCalculateSwapRateFromNPV(vanillaSwap, npv)
Python: CalculateSwapRateFromNPV(npv)
- Function: Calculates the fixed rate from the NPV.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.npv: NPV.
- Returns: Fixed rate.
Excel: =SwapCalculateFloatingMarginFromNPV(vanillaSwap, npv)
Python: CalculateFloatingMarginFromNPV(npv)
- Function: Calculates the floating margin from the NPV.
- Parameters:
vanillaSwap: Interest Rate Swap object,Python API does not require this parameter.npv: NPV.
- Returns: Floating margin.
Excel: =SwapFixedLegs(vanillaSwap, fields)
- Function: Retrieves fixed leg cash flow information.
- Parameters:
vanillaSwap: Interest Rate Swap object.fields: Array of fields (e.g.,PaymentDate,AccrStartDate,AccrEndDate).
- Returns: Fixed leg cash flow information array.
Excel: =SwapFloatingLegs(vanillaSwap, fields)
- Function: Retrieves floating leg cash flow information.
- Parameters:
vanillaSwap: Interest Rate Swap object.fields: Array of fields (e.g.,PaymentDate,AccrStartDate,AccrEndDate).
- Returns: Floating leg cash flow information array.
Excel: =SwapFloatingQuotes(vanillaSwap, fields)
- Function: Retrieves floating leg fixing information.
- Parameters:
vanillaSwap: Interest Rate Swap object.fields: Array of fields (e.g.,QuoteDate,QuoteRate,ResetDate).
- Returns: Floating leg fixing information array.
Excel: =SwapFloatingQuoteLegs(vanillaSwap, fields)
- Function: Retrieves floating leg fixing frequency information.
- Parameters:
vanillaSwap: Interest Rate Swap object.fields: Array of fields (e.g.,QuoteDate,QuoteRate,ResetDate).
- Returns: Floating leg fixing frequency information array.
Excel: =SwapFrtbGirrDeltas(swap, ccyLocRate=1.0, fmt="V")
- Function: Calculates FRTB sensitivity metrics.
- Parameters:
swap: McpVanillaSwap object.ccyLocRate: Local currency exchange rate (default is1.0).fmt: Parameter format (default is"V").
- Returns: FRTB sensitivity metrics.
Excel: =McpGetStartDate(obj)
- Function: Gets the start date of an interest rate swap (VanillaSwap).
- Parameters:
obj: A VanillaSwap object.
- Returns: The start date.
Excel: =McpGetEndDate(obj)
- Function: Gets the end date of an interest rate swap (VanillaSwap).
- Parameters:
obj: A VanillaSwap object.
- Returns: The end date.
Excel: =McpRateConvention(conventionName)
- Function: A function to simplify the definition of interest rate swap product structures.
- Parameters:
conventionName: Structure short name.
- Returns: An interest rate swap product structure object.
Notes
- Parameter Format: The
fmtparameter specifies the parameter format, with a default value ofVP. - Enumeration Values: Some parameters (e.g.,
FixedPayReceive,FixedPaymentFrequency) are enumeration values; refer to specific definitions for details. - Default Values: Parameters not explicitly stated usually have default values, which can be adjusted as needed.
