I tried to do Portfolio optimization, but then the TypeError: minimize_sharpe() missing 1 required positional argument: 'log_returns'
appeared: Please find the extract below.
import scipy.optimize as optimize
optimal_sharpe=optimize.minimize(minimize_sharpe,
initializer,
method = 'SLSQP',
bounds = bounds,
constraints = constraints)
print(optimal_sharpe)
The definition of "minimize_sharpe comes with the following code
def minimize_sharpe(weights, log_returns):
return -portfolio_stats(weights)['Sharpe']