qlLegDuration shows wrong number while qlLegBPS is correct

Posted by imachabeli on
URL: http://quantlib.414.s1.nabble.com/qlLegDuration-shows-wrong-number-while-qlLegBPS-is-correct-tp14565.html

In the same spreadsheet for the same vanilla ATM 5Y usd swap I'm computing duration and BPS,NPV
While bps shows 485(correct value for ATM 5Y)
=qlLegBPS(FixedLeg,TermStructure,IncludeSettlementDateFlows,SettlementDate)

NPV is close to 0 , also ok

duration produced by formula is 2.6 does not make sense to me

=qlLegDuration(FixedLeg,FixedLegRate,FixedLegDayCounter,"Simple","Semiannual","Modified",IncludeSettlementDateFlows,SettlementDate,SettlementDate)


Does this formula really calculates duration?