Skip to content

Instantly share code, notes, and snippets.

@Zmey56
Created May 11, 2022 20:59
Show Gist options
  • Save Zmey56/e6b360adbc3cfdccbcb5a5435eb1bef0 to your computer and use it in GitHub Desktop.
Save Zmey56/e6b360adbc3cfdccbcb5a5435eb1bef0 to your computer and use it in GitHub Desktop.
rf = 0.02
min_vol_port = portfolios_V1.iloc[portfolios_V1['Volatility'].idxmin()]
optimal_risky_port = portfolios_V1.iloc[((portfolios_V1['Returns']-rf)/portfolios_V1['Volatility']).idxmax()]
max_ret_port = portfolios_V1.iloc[portfolios_V1['Returns'].idxmax()]
weights_min_vol = np.array(min_vol_port[2:])
#weights in a portfolio with max Sharpe Ratio
weights_opt_sr = np.array(optimal_risky_port[2:])
#weights in a portfolio with max Returns
weights_max_ret = np.array(max_ret_port[2:])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment