Firstly, this tutorial is really good, both in finance, math, and python. I like it a lot.

I was reading the tutorial of Markowitz Portfolio Optimization (Markowitz Portfolio Optimization | Python/v3 | Plotly). There is an issue about calculation the optimal risk level.

in the optimal_portfolio function,

m1 = np.polyfit(returns, risks, 2)

x1 = np.sqrt(m1[2] / m1[0])

I think it should be : m1 = np.polyfit(risks, returns, 2), because risks is x, and returns is y

Best wishes