# How to compute the Carry + Roll-down of a bond with QuantLib?

I’m new using QuantLib (I have no idea how to use it) and I would like to know how to calculate the C+R of a bond, say the current 30Y.

The textbook definition of C+R is the P&L due to the passage of time, given that the term structure turns out to be as expected. How is this done in QuantLib? How to simulate the passage of time (and the P&L)? How to express our expected term structure?

I would appreciate your help a lot.

• You can either amend the singleton evaluation date and reprice or change the term structure reference date and reprice. Once you have a vector of future prices due to roll, every possible calculation is straightforward. However, building a proper term structure can require some effort (helpers exist anyway). – Lisa Ann Apr 3 '19 at 19:01

## 1 Answer

You have to understand two concepts:

Carry: net income (coupon less financing) that you earn over some horizon. This is essentially Forward Yield - Spot Yield. I won't go into the details of calculating this since you can quickly search it on this forum.

Roll-down: Change in the price of the bond as it rolls down the yield curve assuming its upwards sloping. For example, a 30y bond would roll down to the 29.5y point on the yield curve in six-months. However, it's not as simple as that and you may need to make adjustments. You can express your term structure by pricing all the bonds off a zero-coupon yield curve to get the fair price/yields of the bonds then get your roll-down from there. Otherwise, market observed yields/prices of bonds may be distorted by liquidity premium/repo specialness/coupon effects.

• I got a little confused. From where do I get the zero-coupon yield curve so that it is not distorted by liquidity premium/repo specialness/coupon effects? Because if I build the curve with the market prices of the bonds, then the zero-coupon yield curve would have the same problem, wouldn't it? – Lay González Apr 7 '19 at 15:20