All problems
Frontier Point
Problem
Compute the volatility of a portfolio on the mean-variance frontier.
For target return mu_p and two assets with means mu1, mu2, volatilities sigma1, sigma2, and correlation rho, set w1 = (mu_p - mu2) / (mu1 - mu2) and return the standard deviation of the resulting portfolio. If the means are equal, return sigma1.
Hint
Weights follow from the target return; then apply the two-asset variance formula.
Test cases
case 1
in: [0.08,0.1,0.05,0.2,0.1,0.3]
expected: 0.13740451229854134
case 2
in: [0.05,0.1,0.05,0.2,0.1,0.3]
expected: 0.1
case 3
in: [0.15,0.1,0.05,0.2,0.1,0]
expected: 0.412310562561766
Starter codePython
def frontier_point(mu_p, mu1, mu2, sigma1, sigma2, rho):
# Your code here
pass3 test cases · run your code against them in the editor