Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Capital Allocation Line

Dear Quantopians,

I'm trying to build a capital asset pricing model, basicly i'm copying the notebook from lecture 30 and construct a real return vector as input instead of a random one from the lecture. When i plot the portfolios based on random weights everything seems fine and the efficient frontier intersects (some) of the potential portfolios as it should be.
Next the notebook optimizes the sharperatio and constructs the capital allocation line where the slope should be equal to the optimal sharpe ratio.
The optimal portfolio should be where the Capital allocation line and the efficient frontier are tangent.
I believe that in my notebook there is going something wrong with the sharpe ratio calculations and therefore with the Capital allocation line. When i plot the efficient frontier and the capital allocation line their not even close but still the notebook gives an optimal portofolio that doesn't exist in that specific risk/return ratio.
Since i'm just a beginner with python its hard to see where things go wrong in the code, i hope that somebody could help interpreting where things go wrong.

Thanks in advance,

Sjors