# Understanding DiscountCurve in quantlib

I want to create a TermStructureHandle handle in python using quantlib. I use the DiscountCurve class and enter the list of dates and discount factors as follows:

dates = [ql.Date(9,4,2018), ql.Date(9,4,2019), ql.Date(9,4,2020)]
discfactors = [1, 0.9, 0.8]
dayCount = ql.ActualActual()
disc_curve = ql.DiscountCurve(dates, discfactors, dayCount)
term_structure = ql.YieldTermStructureHandle(disc_curve)


The discount factor derived from this termstructure for two years should be 0.8 but in fact I get

print(abs(discfactors[2]-term_strcuture.discount(2)))
0.00018797232855949364


What is the reason for this? When I insert longer lists of dates and corresponding discount factors the difference keeps increasing.

  term_strcuture.discount(2.0019987)

• Or use term_structure.discount(ql.Date(9,4,2020)). I don't suggest using Act/Act or 30/360 as day counters for the curve, though, as they can give surprising results for some dates. Simple ones like Act/360 or Act/365 are better. Apr 11, 2018 at 9:36