I'm currently a college student in a financial modeling course and we've recently jumped into vba coding. I don't have much experience, so everything is a bit new. We have a question that assigned to us that follows:
A hybrid linked note is an instrument that provides investors fixed income and equity market. It is structured by combining a return that is 75% equity and 25% fixed income. The investment pays the greater of the par value, $1,000, or the price times the 75% percentage increase in the S&P 500 plus 25% the return on the Barclays US Aggregate Index.
Write 2 functions (hlnPayoff, hlnReturn). The first, hlnPayoff, calculates the security payoff at maturity. The second, hlnReturn, calculates the annualized return assuming continuous compounding. The function hlnReturn should call the payoff function.
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit;">Price | Years | SP5000 | SP5001 | Barclay US Agg0 | Barclay US Agg1
953 | 1 | 1783 | 1995 | 1810 | 1887
914 | 2 | 1298 | 1498 | 1909 | 1942
811 | 5 | 1288 | 1568 | 1710 | 1887
733 | 8 | 1335 | 1270 | 1612 | 1923
</code>My code so far is as follow:
The hlnPayoff seems to be working fine, and I'm getting a result that I am satisfied with. But I'm having issues getting the hlnReturn function to work at all. I think my biggest issue is that the hlnReturn needs to call the hlnPayoff funtion, and I'm not entirely sure how to make that work. My issue seems to be that I'm getting an "argument not optional" error, and I'm not sure how to correct it.
A hybrid linked note is an instrument that provides investors fixed income and equity market. It is structured by combining a return that is 75% equity and 25% fixed income. The investment pays the greater of the par value, $1,000, or the price times the 75% percentage increase in the S&P 500 plus 25% the return on the Barclays US Aggregate Index.
Write 2 functions (hlnPayoff, hlnReturn). The first, hlnPayoff, calculates the security payoff at maturity. The second, hlnReturn, calculates the annualized return assuming continuous compounding. The function hlnReturn should call the payoff function.
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit;">Price | Years | SP5000 | SP5001 | Barclay US Agg0 | Barclay US Agg1
953 | 1 | 1783 | 1995 | 1810 | 1887
914 | 2 | 1298 | 1498 | 1909 | 1942
811 | 5 | 1288 | 1568 | 1710 | 1887
733 | 8 | 1335 | 1270 | 1612 | 1923
</code>My code so far is as follow:
Code:
Function hlnPayoff(price As Currency, sp0 As Currency, sp1 As Currency, bar0 As Currency, bar1 As Currency)
Const par As Currency = 1000
hlnPayoff = price * (1 + (((sp1 - sp0) / sp0) * 0.75) + (((bar1 - bar0) / bar0) * 0.25))
If hlnPayoff < par Then
hlnPayoff = par
Else
hlnPayoff = hlnPayoff
End If
End Function
Function hlnReturn(price As Currency, years As Integer, sp0 As Currency, sp1 As Currency, bar0 As Currency, bar1 As Currency)
hlnReturn = Application.WorksheetFunction.Ln(hlnPayoff / price) / years
End Function
The hlnPayoff seems to be working fine, and I'm getting a result that I am satisfied with. But I'm having issues getting the hlnReturn function to work at all. I think my biggest issue is that the hlnReturn needs to call the hlnPayoff funtion, and I'm not entirely sure how to make that work. My issue seems to be that I'm getting an "argument not optional" error, and I'm not sure how to correct it.