Excel's add-in named "Analysis ToolPak" provides "Yield" function for calculation of yield on security that pays periodic interest.
Function works well and returns proper data.
My understanding is function base on kind of iteration it is not so easy implement it in my code.
My question is anybody know/seen implementation in C# (eventually other languages) and can share? Or (maybe) some tips how to implement it? Than I can share :)
EDIT:
Thanks all posting me "formula" but this is not fully useful to me.
Please note that MS' formula finds application in 1 case only:
"when there is one coupon period or less until redemption",
otherwise:
"(...) Yield is calculated through a hundred iterations."
and there is no exact formula for that case
I can read equations and implement them (hopefully), but my question was if somebody has or saw already implemented function in programming language.
I'm not lazy but I dont like break down open doors...