In cashflows.cpp simpleDuration, modifiedDuration and convexity don't work with Act/Act(ISMA) because of use of two argument dc.yearFraction. With Act/Act(ISMA) this form of yearFraction will always return 1.0 as the reference period is set equal to the first two arguments.
I have been experimenting with code similar to the loop in the npv routine to extract the coupon reference periods and sum the yearFractions in the duration loop (code attached). This seems to produce the correct result, although I am not convinced how well it will operate if npvDate != settlementDate.
Something similar could probably be done with convexity.
Log in to post a comment.