Re: Question about a formula of calculation of Yield of Bond in Quantlib
Posted by
Luigi Ballabio on
Apr 13, 2017; 7:17am
URL: http://quantlib.414.s1.nabble.com/Question-about-a-formula-of-calculation-of-Yield-of-Bond-in-Quantlib-tp18170p18192.html
It's not a formula, it's the application of an iterative solver. The functions use one of the root solvers available in the library to find the zero of the CashFlows::IrrFinder::operator()(Rate y) method. In short: given a guess for the yield, the IrrFinder class calculates the corresponding price of the bond (see the call to CashFlows::npv in the IrrFinder::operator() method) and returns the difference between the calculation and the target price. The used solver iteratively changes the guess and tries to find the value for which difference is zero, that is, the yield for which the calculated price equals the target price.
Luigi
The parts of codes Bond::Yield (BondsFunctions)-> CashFlows::Yield , in these functions, the formula to calculate the result of yield.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org!
http://sdm.link/slashdot_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users