Unicorn_Bazooka
New Member
- Joined
- Nov 28, 2016
- Messages
- 1
Given
YTM- between 0 and 1
C are coupon rates, for example 7, 7, 9
P are the dirty price, for example 101, 148, 192
R = positive integer values
S= positive integer values
N= positive integer values between 0 and 20
E=1 (always for each row of data)
Function==>f(YTM, c, P, r, s,n,e) = d^(r/s)*((e*(c/2)+(c/2)*(d-d^(n+1))/(1-d)+100*d^n)-P
where d= 1/(1+ytm/2)
how would I implement a bisection function which will check for values between 0.000001 and 1 to solve for YTM (obviously when the above function = 0) ?
I understand YTM is going to an interest rate of sort so it has to be between 0 and 1 strictly positive for this function.
Also how would I make a command button (on click it will compute the bisection for many rows of variables)?
YTM- between 0 and 1
C are coupon rates, for example 7, 7, 9
P are the dirty price, for example 101, 148, 192
R = positive integer values
S= positive integer values
N= positive integer values between 0 and 20
E=1 (always for each row of data)
Function==>f(YTM, c, P, r, s,n,e) = d^(r/s)*((e*(c/2)+(c/2)*(d-d^(n+1))/(1-d)+100*d^n)-P
where d= 1/(1+ytm/2)
how would I implement a bisection function which will check for values between 0.000001 and 1 to solve for YTM (obviously when the above function = 0) ?
I understand YTM is going to an interest rate of sort so it has to be between 0 and 1 strictly positive for this function.
Also how would I make a command button (on click it will compute the bisection for many rows of variables)?