I'm trying to get the basics of bonds by going from yield to price (and vice-versa hopefully). What I want to do is from publicly available source go from the treasury bond yield to the price. So for example using MarketWatch I see:

2Y Treasury Data

So I assume the remaining coupons are paid 4 and paid at the end of April and October and calculate the present value of the cashflows using:


From what I obtain a table like this:

enter image description here

Now if I sum all the values I find that the price is 99.89, not really close to the 99 8/32 (99.25) shown by marketwatch. I have tried also changing the conventions to 365 and yearly compounding, but doesn't improve much. I've also tried to account for the accrued interest (0.205) and substract it to see if it matches the clean price, but also doesn't work (result is 99.68).

Could you please help me understand what I'm doing wrong here?


  • 2
    $\begingroup$ 2023-04-30 is a Sunday for example. You would need all details to really get the exact price. $\endgroup$
    – AKdemy
    Nov 17, 2022 at 18:10
  • 1
    $\begingroup$ If you look at professionally written code for yield to price and price to yield you might be surprised how complicated it is to do it absolutely right and handle all the possible cases (like: are we in a leap year or a non leap year). OTOH it is fun for a certain kind of programmer ;) $\endgroup$
    – nbbo2
    Nov 17, 2022 at 19:57

1 Answer 1


There is something wrong with that screenshot. The price that corresponds to a 4.475 yield should be 99-26 which is close to the value you calculated. Mentally you can check this because the yield is 10bp higher than the coupon, so the price should be the 100- the PV of 10bp for 2 yrs so about 99.80.

Fwiw The correct method is to use a Act/365 day count and then subtract accrued interest. There are a lot of other nuances but that is basically correct.


Not the answer you're looking for? Browse other questions tagged or ask your own question.