Lenny D. answered 07/13/19
Financial Professional with many years of Wall Street Experience
Actually, If you know the Yield to maturity you can simply solve for price as the sum of the present value of the coupon stream and the present value of the principal. If you know the price you have to solve for yield iteratively. One way is to use Newton's method with either DV01 or Duration based increments.. This is how you would do it using DV01 (delta value of a 1 basis point change in Yield). Define the squeeze factor k such that 0<k< 1 choosing k close to one will have faster convergence. We need to have an initial guess for the yield it is arbitrary but you might as well set it = the coupon rate. For example, an 8% bond with a YTM of 8% will be priced at par. Now price the bond at 8.01% The Difference in the bond prices is the DV01.. Suppose the actual bond price is 101 and the DV01 is. -.05. That is, raising the YTM from 8% to 8.01% lowers the price from 100 to 99.95.
We need to see a lower yield than 8% to get the price to 101. If 1 basis point is a nickel 20 basis points may equal a dollar.. However, we don't know how stable the DV01 number is so we'll choose our squeeze factor, k to be .8. so we will re price the cash flows at .8*20 basis points below 8% or 7.84%. At 7.84% we see the bond is worth 100.85. we recalculate the DV01 and iterate again. We choose a convergence criterion e.g if the price is within .0001 we will stop iterating.
I hope this helps
If you have any questions in finance, options, derivatives, economics etc please reach out. I ran trading desks on wall street and taught economics at Tufts.