# Forward pricing of cashflows with QuantLib - Python

I am building a tool with Quantlib (Python) to work on the forward pricing of different types of assets (inflation linked, amortizing, vanilla, zero coupon bonds).

For a number of reasons I am using the bonds cashflow series as provided by an internal system. From the same system I can get the discount factors associated to each cashflow. So from the start date to the maturity of the bond I have the date schedule, the cashflow amount and the discount factors.

At this stage I do the following:

1. I take the discount factors and I build my Term structure object
2. I build the series of ql.SimpleCashFlow(amount, date) object
3. I compute the npv of the cashflow series with ql.CashFlows.npv(cfs, discountTermStructure, False, reference_date), where cfs is the series of ql.SimpleCashflow, discountTermStructure is my discount curve and reference date is the as of date of the npv.

My doubt is when it comes to moving the reference date forward. At high level I expect that the discountTermStructure is built from the today discount curve (discount factors taken from the internal system at today date) and then when I use a reference date equal to the forward date, this makes the implied discount curve in the discountTermStructure to be the forward discount curve, so that the discounting is performed only for the cashflows following the reference date and with the forward discount factors (implied in today discount curves).

Is the above correct?

Following my code (I will avoid displaying the inputs for simplicity)

'''
my discount curve object
'''
discountCurve = ql.DiscountCurve(dates_schedule, discount_factors, dayCount)

''' my cashflow series, leg is a list of cashflow amounts'''
cfs = [ql.SimpleCashFlow(cashflow, d) for d, cashflow in zip(dates, leg) ]

''' NPV calculation, as at reference_date which can be today or forward date '''
P = ql.CashFlows.npv(cfs, discountTermStructure, False, reference_date)


Should I also insert

ql.Settings.instance().setEvaluationDate(reference_date)


before the calculation of the NPV?

Thanks!

P = ql.CashFlows.npv(cfs, discountTermStructure, True, reference_date)