Finance
Convexity
calculate the convexity of a set of cash flows or a bond
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
Convexity(cashflows, rate, opts)
Convexity(bond, rate, opts)
cashflows
-
data structure created using the SimpleCashFlow constructor or a list of such data structures; cash flows
bond
fixed or floating rate bond data structure; bond
rate
non-negative real number; interest rate
opts
equations of the form option = value where option is one of evaluationdate, compounding or daycounter; specify options for the Convexity command
compounding = Simple, Continuous, Annual, Semiannual, EveryFourthMonth, Quarterly, Bimonthly, Monthly, SimpleThenAnnual, SimpleThenSemiannual, SimpleThenEveryFourthMonth, SimpleThenQuarterly, SimpleThenBimonthly, or SimpleThenMonthly -- This option specifies the compounding type for the given interest rate.
daycounter = a name representing a supported day counter (e.g. ISDA, Simple) or a day counter data structure created using the DayCounter constructor -- This option provides a day counter which will be used to convert the period between two dates as a fraction of the year.
evaluationdate = a string containing a date specification in a format recognized by ParseDate or a Date data structure -- This option specifies the evaluation date. By default this is set to the global evaluation date (see EvaluationDate).
The Convexity command calculates the convexity of a set of cash flows or a bond.
For a set of cash flows Ci⁡t the convexity is defined as
∑i⁡t2⁢Ci⁡t⁢Pt∑i⁡Ci⁡t⁢Pt
where Pt is the discount factor at time t implied by the given interest rate.
A bond's convexity is defined as the weighted second derivative of the price function with respect to the interest rate:
ⅆ2ⅆr2B⁡rB⁡r
The parameter cashflows is a cash flow or a list of cash flows (see FixedRateCoupon, InArrearIndexedCoupon, ParCoupon, SimpleCashFlow, or UpFrontIndexedCoupon).
The parameter bond must be a fixed- or floating-rate bond data structure (see FixedCouponBond, FloatingRateBond, ZeroCouponBond).
with⁡Finance:
SetEvaluationDate⁡Jan-01-2005:
paymentdate≔Jan-02-2007
cashflow1≔SimpleCashFlow⁡100,paymentdate
cashflow1≔100. on January 2, 2007
Convexity⁡cashflow1,0.03,evaluationdate=Jan-01-2005
4.010966410
Convexity⁡cashflow1,0.03,evaluationdate=Jan-01-2004
9.016445862
Here is another example.
nominalamt≔100
rate≔0.05
paymentdate≔Jan-01-2015
startdate≔Jan-01-2006
enddate≔Jan-01-2010
coupon≔FixedRateCoupon⁡nominalamt,rate,startdate,enddate,paymentdate
coupon≔20. on January 1, 2015
Compute the value of this cash flow on January 01, 2005.
Convexity⁡coupon,0.03,evaluationdate=Jan-01-2005
100.
Here is an example using bonds.
bond≔FixedCouponBond⁡100,5,Years,0.05
bond ≔ moduleend module
cflows≔CashFlows⁡bond
cflows≔5. on 'January 1, 2006',5. on 'January 1, 2007',5. on 'January 1, 2008',5. on 'January 1, 2009',5. on 'January 1, 2010',100. on 'January 1, 2010'
Convexity⁡bond,0.03,evaluationdate=Jan-05-2000
92.45245571
Convexity⁡cflows,0.03,evaluationdate=Jan-05-2000
The Finance[Convexity] command was introduced in Maple 15.
For more information on Maple 15 changes, see Updates in Maple 15.
See Also
Finance[CompoundFactor]
Finance[DiscountFactor]
Finance[Duration]
Finance[EvaluationDate]
Finance[FixedRateCoupon]
Finance[InArrearIndexedCoupon]
Finance[NetPresentValue]
Finance[ParCoupon]
Finance[SetEvaluationDate]
Finance[SimpleCashFlow]
Finance[UpFrontIndexedCoupon]
Finance[ZeroCurve]
Download Help Document