# How to price a bond at specified dates in QuantLib

I am wondering what's the most efficient way (i.e. the method which involves the fewest arguments) to price a bond at a specified date, e.g. a future date (as instance, 6 months from now) in QuantLib.

Let the object of class Bond is then priced using BondSetCouponPricer() and InstrumentSetPricingEngine() with a non-flat object of YieldTermStructure class (like a zero yield curve): does this take into account the whole shape of the yield term structure, considering the bond is not priced today but at a "new" tenor due to the fact that in this simulation six months have passed?

What if the Bond object is of FloatingRateBond class, thus having an IborIndex made up by an additional object of class YieldTermStructure?

Does this take into consideration the "new" tenor due to the fact that in this simulation six months have passed?

Thanks,

-
theres no shortcuts, make a wrapper function to simply it for your needs.... – pyCthon Sep 6 '13 at 1:16
What if I amend the issueDate argument (Default value = QuantLib::Date()) and the zero curve? The former can bet set equal to today() + 6M; the latter can be shifted in order to make, as instance, the 1Y tenor become the 18M tenor (= 1Y + 6M) of the "new" curve... and so on. – Lisa Ann Sep 6 '13 at 6:57

There are two different issues at play here.

One is that, of course, you want only the future cash flows to enter the calculation. This is taken care when you set the evaluation date to 6 months from today. In C++, you would say

Settings::instance().evaluationDate() = today + 6*Months;


I don't remember the corresponding function in QuantLibXL, but you can look for some function with "setEvaluationDate" in its name or something similar. On the hand, the issue date of the bond has no effect.

The second issue is how you manage the term structure, and that depends on what you want to do. If, as I guess, you want to infer the future curve from today's one (so that, for instance, the spot 6-months rate on the new curve would be the forward 6-months to 1-year rate on today's curve) you can use—at least in C++; I hope it's exported to Excel—the ImpliedTermStructure class. It takes your current curve and a reference date (in your case, today + 6M) and builds a new curve with the desired behavior.

If, instead—but I don't think it's your case, right?—you wanted to move today's curve to the new date as it is (that is, so that the spot 6-months rate on the new curve equals the spot 6-months rate on the old one) this can be done by building the curve so that it moves with the evaluation date. It's usually done to calculate the theta numerically by moving everything ahead one day.

The above also applies to the floating-rate index and its forecast curve.

-
In QuantLibXL SettingsSetEvaluationDate is available, and it can do what you said above. Currently I've played a bit with ZeroCurve class to accomplish the second type of simulation, that is, shifting the zero curve along the tenor axis as it should keep its current shape in the future, too. I am looking forward to experiment with the ImpliedTermStructure class following your advices. By the way... Luigi, you're becoming my very QuantLib savior on this site :) How much reputation do you wanna get, actually? :D – Lisa Ann Sep 6 '13 at 10:28