YieldCurve Related Functions
About 5 min
YieldCurve Related Functions
Visit the Mathema Option Pricing System for foreign exchange options and structured product valuation!
YieldCurve Construction Functions
Excel: =McpYieldCurve2(args1, args2, args3, args4, args5, fmt="VP|HD")
Python: McpYieldCurve2(*args)
- Function: Constructs a bilateral yield curve.
- Parameters:
args1~args5 or *args: Parameter groups, supporting the following three input methods:- Interest Rate Data Construction:
ReferenceDate: Trade date or valuation date.Tenors: Array of tenors.BidZeroRates: Array of bid-side zero rates.AskZeroRates: Array of ask-side zero rates.Frequency: Period (default isNoFrequency).Variable: Interest rate type (default isSIMPLERATES).Method: Interpolation method (default isLINEARINTERPOLATION).Calendar: Holiday calendar object (default is empty).DayCounter: Day count convention (default isAct360).ValueDate: Value date.
- Bid/Ask Yield Curve Construction:
BidYieldCurve: Bid-side yield curve object.AskYieldCurve: Ask-side yield curve object.
- Forward Curve Construction:
FxForwardPointsCurve2: Forward curve object.YieldCurve2: Yield curve object.CalculatedTarget: Calculation target (enumeration value).Calendar: Holiday calendar object.
- Interest Rate Data Construction:
fmt: Parameter format (default isVP|HD),Excel-specific parameters.
- Returns: Bilateral yield curve object.
Excel: =McpYieldCurve(args1, args2, args3, args4, args5, fmt="VP|HD")
Python: McpYieldCurve(*args)
- Function: Constructs a unilateral yield curve.
- Parameters:
args1~args5 or *args: Parameter groups, supporting the following two input methods:- Date Parameters:
ReferenceDate: Trade date or valuation date.Dates: Array of dates.ZeroRates: Array of zero rates.Frequency: Period (default isNoFrequency).Variable: Interest rate type (default isSIMPLERATES).Method: Interpolation method (default isLINEARINTERPOLATION).
- Tenor Parameters:
ReferenceDate: Trade date or valuation date.Tenors: Array of tenors.ZeroRates: Array of zero rates.Method: Interpolation method (default isLINEARINTERPOLATION).Calendar: Holiday calendar object (default is empty).DayCounter: Day count convention (default isActActISDA).ValueDate: Value date.
- Date Parameters:
fmt: Parameter format (default isVP|HD),Excel-specific parameters.
- Returns: Unilateral yield curve object.
YieldCurve Usage Functions
Excel: =YieldCurve2ZeroRate(Curve, Date, BidMidAsk)
Python: ZeroRate(*args)
- Function: Retrieves the zero rate for a specified date from a bilateral yield curve.
- Parameters:
Curve: Bilateral yield curve object.Date: Target date.BidMidAsk: Specifies the direction (bid,mid, orask).*args:is a dictionary, does not require the Curve parameter, other parameters are the same as those in Excel.
- Returns: Zero rate for the specified direction.
- Example:Returns
=YieldCurve2ZeroRate(McpYieldCurve2(...), "2023-12-31", "mid")0.025(assuming the mid rate is 2.5%).
Excel: =YieldCurveZeroRate(Curve, Date)
Python: ZeroRate(endDate)
- Function: Retrieves the zero rate for a specified date from a unilateral yield curve.
- Parameters:
Curve: Unilateral yield curve object,Python API does not require this parameter.Date: Target date.
- Returns: Zero rate.
Excel: =YieldCurve2DiscountFactor(Curve, Date, BidMidAsk)
Python: DiscountFactor(*args)
- Function: Retrieves the discount factor for a specified date from a bilateral yield curve.
- Parameters:
Curve: Bilateral yield curve object.Date: Target date.BidMidAsk: Specifies the direction (bid,mid, orask).*args:is a dictionary, does not require the Curve parameter, other parameters are the same as those in Excel.
- Returns: Discount factor for the specified direction.
Excel: =YieldCurveDiscountFactor(Curve, Date)
Python: DiscountFactor(*args)
- Function: Retrieves the discount factor for a specified date from a unilateral yield curve.
- Parameters:
Curve: Unilateral yield curve object.Date: Target date.*args:is a dictionary, does not require the Curve parameter, other parameters are the same as those in Excel.
- Returns: Discount factor.
SwapCurve Related Functions
SwapCurve Construction Functions
Excel: =McpVanillaSwapCurveData(args1, args2, args3, args4, args5, Fmt)
Python: McpVanillaSwapCurveData(*args)
- Function: Constructs a unilateral SwapCurve.
- Parameters:
args1, args2, args3, args4, args5 or *args: Parameter group, supporting the following three input methods:- First Parameter Set:
ReferenceDate: Trade date or valuation date.StartDate: Start date.MaturityDates: Array of maturity dates.Frequencies: Array of frequencies.Coupons: Array of coupon rates.FixedDayCounter: Fixed leg day count convention (default isAct365Fixed).FloatDayCounter: Floating leg day count convention (default isAct365Fixed).BumpAmounts: Array of rate bumps (e.g.,0.01adds 0.01 to all rates).BUses: Whether to use the row data (YorN).Calendar: Array of holiday calendars.AdjustRule: Adjustment rule (default isModifiedFollowing).UseIndexEstimation: Whether to use floating rate index estimation (default isTRUE).SwapStartLag: Value date adjustment (default is2).CompoundingFrequency: Compounding frequency (default is0).FixInAdvance: Fixed in advance flag (default istrue).FixDaysBackward: Floating rate fixing days backward (default is1).EndStub: Default isfalse.
- Second Parameter Set:
- Similar to the first set but omits some parameters.
- Third Parameter Set:
- Similar to the first set but adds
FixingIndex,FixingRateMethod, etc.
- Similar to the first set but adds
- First Parameter Set:
fmt: Parameter format VP|HD, specifically for Excel.
- Returns: VanillaSwapCurve object.
Excel: =McpSwapCurve(args1, args2, args3, args4, args5, fmt="VP")
Python: McpSwapCurve(*args)
- Function: Constructs a unilateral SwapCurve object.
- Parameters:
args1~args5 or *args: Parameter groups, supporting the following two input methods:- First Parameter Set:
SettlementDate: Trade date.CalibrationSet: Portfolio of instruments (e.g., VanillaSwaps or Deposits) used to build the curve.InterpolatedVariable: Interest rate type (enumeration value).InterpolationMethod: Interpolation method (enumeration value).DayCounter: Day count convention (default isAct365Fixed).UseGlobalSolver: Whether to use a global solver (default isTrue).PillarEndDate: Default is0.
- Second Parameter Set:
ReferenceDate: Trade date.InterpolatedVariable: Interest rate type (enumeration value).InterpolationMethod: Interpolation method (enumeration value).FixedDayCounter: Fixed leg day count convention (default isAct365Fixed).FloatDayCounter: Floating leg day count convention (default isAct365Fixed).DayCounter: Day count convention (default isAct365Fixed).Calendar: Holiday calendar object.AdjustRule: Adjustment rule (enumeration value).SettlementDates: Array of settlement dates.MaturityDates: Array of maturity dates.Coupons: Array of coupon rates.FixedFrequencies: Array of fixed leg frequencies.FloatingFrequencies: Array of floating leg frequencies.BumpAmounts: Array of rate bumps.BUses: Whether to use the row data (YorN).
- First Parameter Set:
fmt: Parameter format (default isVP),Excel-specific parameters.
- Returns: Unilateral SwapCurve object.
Excel: =McpSwapCurve2(args1, args2, args3, args4, args5, fmt="VP")
- Function: Constructs a bilateral SwapCurve object.
- Parameters: Similar to
McpSwapCurve, supporting two input methods. - Returns: Bilateral SwapCurve object.
SwapCurve Usage Functions
Excel: =SwapCurveZeroRate(curve, date)
Python: ZeroRate(endDate)
- Function: Retrieves the zero rate for a specified date from a SwapCurve.
- Parameters:
curve: Swap curve object,Python API does not require this parameter.date: Target date.
- Returns: Zero rate.
Excel: =SwapCurveZeroRates(curve, dates, fmt='V')
- Function: Retrieves zero rates for multiple dates from a SwapCurve.
- Parameters:
curve: Swap curve object.dates: Array of dates.fmt: Return format (default isV).
- Returns: Array of zero rates.
Excel: =SwapCurveDiscountFactor(curve, date)
Python: DiscountFactor(endDate)
- Function: Retrieves the discount factor for a specified date from a SwapCurve.
- Parameters:
curve: Swap curve object,Python API does not require this parameter.date: Target date.
- Returns: Discount factor.
Excel: =SwapCurveDiscountFactors(curve, dates, fmt='V')
- Function: Retrieves discount factors for multiple dates from a SwapCurve.
- Parameters:
curve: Swap curve object.dates: Array of dates.fmt: Return format (default isV).
- Returns: Array of discount factors.
Excel: =YieldCurveForwardRate(curve, startDate, endDate, dayCounter=DayCounter.Act365Fixed, compounding=False, frequency=Frequency.NoFrequency)
Python: ForwardRate(startDate, endDate, dayCounter, compounding, frequency)
- Function: Retrieves the forward rate from a SwapCurve.
- Parameters:
curve: Swap curve object,Python API does not require this parameter.startDate: Start date.endDate: End date.dayCounter: Day count convention (default isAct365Fixed).compounding: Whether to use compounding (default isfalse).frequency: Compounding frequency (default isNoFrequency).
- Returns: Forward rate.
Excel: =SwapCurveParSwapRate(curve, start, end)
- Function: Calculates the par swap rate for a given interest rate curve.
- Parameters:
curve: The interest rate curve object.start: The start tenor of the interest rate swap.end: The end tenor of the interest rate swap.
- Returns: The calculated par swap rate value.
Excel: =SwapCurveCarry(curve, horizon, maturityPeriod)
- Function: Calculates the carry (holding收益) for a given interest rate curve.
- Parameters:
curve: The interest rate curve object.horizon: The start tenor of the holding period.maturityPeriod: The end tenor of the holding period (or the instrument's maturity period).
- Returns: The calculated carry value.
Excel: =SwapCurveRoll(curve, horizon, maturityPeriod)
- Function: Calculates the roll (rolling收益) for a given interest rate curve.
- Parameters:
curve: The interest rate curve object.horizon: The start tenor of the roll period.maturityPeriod: The end tenor of the roll period (or the instrument's maturity period).
- Returns: The calculated roll value.
Notes
- Parameter Format: The
fmtparameter specifies the format of the parameters, with a default value ofVP|HDorVP. - Enumeration Values: Some parameters (e.g.,
Frequency,Variable,Method) 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.
