Structured Products (OTC Derivatives and Structured Deposits) Related Functions
About 3 min
Structured Products (OTC Derivatives and Structured Deposits) Related Functions
Visit the Mathema Option Pricing System for foreign exchange options and structured product valuation!
Constructor Functions
Excel: =McpStructureDef(packageName, structure, schedule1, payoff, schedule2)
Python: McpStructureDef(pkg_name, structure, schedules, payoff)
- Function: Defines the structure of a structured product.
- Parameters:
packageName
: Package name.structure
: Structure definition, containing the following fields:Dates
: Date definitions.Strikes
: Strike price definitions.StrikesStructure
: Strike price conditions.Arguments
: Parameters such as interest rates and principal.Calendar
: Holiday calendar.Basis
: Day count convention.
schedule1
: Schedule definition 1, containing the following fields:ScheduleName
: Name of the schedule definition.StartDate
: Start date.EndDate
: End date.Frequency
: Frequency.Calendar
: Holiday calendar.DateAdjuster
: Date adjustment rule.EndtoEnd
: End-of-month rule.LongStub
: Long stub.EndStub
: End stub.
payoff
: Payoff definition, specifying the logic.schedule2
: Schedule definition 2 (generated from schedule definition 1).
- Returns: Structured product definition object.
Excel: =McpXScriptStructure(args1, args2, args3, args4, args5, fmt='VP|HD')
Python: McpXScriptStructure(*args)
- Function: Constructs an XScriptStructure object.
- Parameters:
args1~args5 or *args
: Parameter groups, containing the following fields:Underlying
: Product.ReferenceDate
: Trading or valuation date.PackageName
: Package name.Spot
: Spot price.BuySell
: Buy or sell direction (buy
orsell
).StartDate
: Start date.ExpiryDate
: Expiry date.PremiumDate
: Option premium payment date.Calendar
: Holiday calendar.LowerBarrier
: Lower barrier price.UpperBarrier
: Upper barrier price.HighYield
: High yield.MidYield
: Medium yield.LowYield
: Low yield.Notional
: Principal.ObservationSchedule/Frequency
: Frequency in the schedule definition.ObservationSchedule/StartDate
: Start time in the schedule definition.ObservationSchedule/EndDate
: End time in the schedule definition.NumSimulation
: Number of simulations.LocalVol
: LocalVol object.LogLevel
: Log level.DiscountRateCurve
: Discount rate curve.
fmt
: Parameter format (defaultVP|HD
),Excel-specific parameters.
- Returns: XScriptStructure object.
Utility Functions
Excel: =XssPrice(obj, isAmount=True)
Python: Price(isAmount=True)
- Function: Calculates the option premium.
- Parameters:
obj
: XScriptStructure object,Python API does not require this parameter.isAmount
: Whether to return the amount (defaultTrue
, returns the amount;False
returns the rate).
- Returns: Option premium.
Excel: =XssAnnualizedPrice(obj)
Python: AnnualizedPrice()
- Function: Calculates the annualized yield.
- Parameters:
obj
: XScriptStructure object,Python API does not require this parameter.
- Returns: Annualized yield.
Excel: =XssMarketValue(obj, isAmount=True)
Python: MarketValue(isAmount=True)
- Function: Calculates the market value.
- Parameters:
obj
: XScriptStructure object,Python API does not require this parameter.isAmount
: Whether to return the amount (defaultTrue
).
- Returns: Market value.
Excel: =XssDelta(obj, isCCY2=True, isAmount=True)
Python: Delta(isCCY2=False, isAmount=True)
- Function: Calculates Delta.
- Parameters:
obj
: XScriptStructure object,Python API does not require this parameter.isCCY2
: Whether to price in CCY2 (defaultTrue
).isAmount
: Whether to return the amount (defaultTrue
).
- Returns: Delta.
Excel: =XssForwardDelta(obj, isCCY2=True, isAmount=True)
Python: ForwardDelta(isCCY2=False, isAmount=True)
- Function: Calculates Forward Delta.
- Parameters:
obj
: XScriptStructure object,Python API does not require this parameter.isCCY2
: Whether to price in CCY2 (defaultTrue
).isAmount
: Whether to return the amount (defaultTrue
).
- Returns: Forward Delta.
Excel: =XssGamma(obj, isCCY2=True, isAmount=True)
Python: Gamma(isCCY2=False, isAmount=True)
- Function: Calculates Gamma.
- Parameters:
obj
: XScriptStructure object,Python API does not require this parameter.isCCY2
: Whether to price in CCY2 (defaultTrue
).isAmount
: Whether to return the amount (defaultTrue
).
- Returns: Gamma.
Excel: =XssTheta(obj, isCCY2=True, isAmount=True)
Python: Theta(isCCY2=False, isAmount=True)
- Function: Calculates Theta.
- Parameters:
obj
: XScriptStructure object,Python API does not require this parameter.isCCY2
: Whether to price in CCY2 (defaultTrue
).isAmount
: Whether to return the amount (defaultTrue
).
- Returns: Theta.
Excel: =XssRho(obj, isCCY2=True, isAmount=True)
Python: Rho(isCCY2=False, isAmount=True)
- Function: Calculates Rho.
- Parameters:
obj
: XScriptStructure object,Python API does not require this parameter.isCCY2
: Whether to price in CCY2 (defaultTrue
).isAmount
: Whether to return the amount (defaultTrue
).
- Returns: Rho.
Excel: =XssVanna(obj, isCCY2=True, isAmount=True)
Python: Vanna(isCCY2=False, isAmount=True)
- Function: Calculates Vanna.
- Parameters:
obj
: XScriptStructure object,Python API does not require this parameter.isCCY2
: Whether to price in CCY2 (defaultTrue
).isAmount
: Whether to return the amount (defaultTrue
).
- Returns: Vanna.
Excel: =XssVolga(obj, isCCY2=True, isAmount=True)
Python: Volga(isCCY2=False, isAmount=True)
- Function: Calculates Volga.
- Parameters:
obj
: XScriptStructure object,Python API does not require this parameter.isCCY2
: Whether to price in CCY2 (defaultTrue
).isAmount
: Whether to return the amount (defaultTrue
).
- Returns: Volga.
Excel: =XssVega(obj, isCCY2=True, isAmount=True)
Python: Vega(isCCY2=False, isAmount=True)
- Function: Calculates Vega.
- Parameters:
obj
: XScriptStructure object,Python API does not require this parameter.isCCY2
: Whether to price in CCY2 (defaultTrue
).isAmount
: Whether to return the amount (defaultTrue
).
- Returns: Vega.
Excel: =XssPV(obj, isAmount=True)
Python: PV(isAmount)
- Function: Calculates the present value of the XScriptStructure object.
- Parameters:
obj
: XScriptStructure object, used to calculate the present value,Python API does not require this parameter.isAmount
: Boolean, default valueTrue
, indicating whether to calculate by amount.
- Returns: Present value calculation result.
Excel: =McpProductEvents(prod)
- Function: Generates Payoff.
- Parameters:
prod
: XScriptStructure object.
- Returns: Payoff result.
Excel: =SolverFromPremium(priceObj, premium, targetField, x0=1.0, bracket=(-100, 100), method='bisect', options={'maxiter': 50, 'xtol': 1e-6}, isAnnualized=False)
- Function: Back-calculates the target value based on the option premium or annualized rate.
- Parameters:
priceObj
: XScriptStructure object.premium
: Option premium or annualized rate.targetField
: Target field for calculation.x0
: Initial estimate (default1.0
).bracket
: Range of guess values (default(-100, 100)
).method
: Solver method (defaultbisect
).options
: Maximum iterations (default50
), tolerance precision (default1e-6
).isAnnualized
: Whether it is an annualized rate (defaultFalse
).
- Returns: Back-calculated result.
Notes
- Parameter Format: The
fmt
parameter specifies the parameter format, with a default value ofVP|HD
. - Enumeration Values: Some parameters (e.g.,
BuySell
,DateAdjuster
) are enumeration values and should refer to specific definitions. - Default Values: Parameters not explicitly stated usually have default values and can be adjusted as needed.