You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxportfolio/policies.py", line 459, in _recursive_values_in_time
self.problem.solve(**self.cvxpy_kwargs)
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxpy/problems/problem.py", line 495, in solve
return solve_func(self, *args, **kwargs)
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxpy/problems/problem.py", line 1070, in _solve
self.unpack_results(solution, solving_chain, inverse_data)
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxpy/problems/problem.py", line 1395, in unpack_results
raise error.SolverError(
cvxpy.error.SolverError: Solver 'ECOS' failed. Try another solver, or solve with verbose=True for more information.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/venkatradha/PycharmProjects/pythonProject/main_yearly.py", line 199, in
esg_avg_weights, esg_avg_returns, esg_avg_annualized_return = get_weights_returns(esg_avg_universe)
File "/Users/venkatradha/PycharmProjects/pythonProject/main_yearly.py", line 24, in get_weights_returns
result = simulator.backtest(policy, start_time=start_time, end_time=end_time)
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxportfolio/simulator.py", line 668, in backtest
return self.backtest_many([policy], start_time=start_time, end_time=end_time,
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxportfolio/simulator.py", line 732, in backtest_many
result = list(starmap(self._worker, zip_args))
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxportfolio/simulator.py", line 640, in _worker
return simulator._concatenated_backtests(policy, start_time, end_time, h)
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxportfolio/simulator.py", line 600, in _concatenated_backtests
results.append(self._single_backtest(
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxportfolio/simulator.py", line 552, in _single_backtest
result.policy_times.loc[t] = self._simulate(
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxportfolio/simulator.py", line 479, in _simulate
z = policy._recursive_values_in_time(
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxportfolio/policies.py", line 461, in _recursive_values_in_time
raise PortfolioOptimizationError(
cvxportfolio.errors.PortfolioOptimizationError: Numerical solver for policy MultiPeriodOptimization at time 2010-06-01 00:00:00 failed;try changing it, relaxing some constraints, or dropping some costs.
The text was updated successfully, but these errors were encountered:
Hello, this error comes from cvxpy solver settings and is due to a misspecified problem (probably the covariance matrix is near singular), it's not a cvxportfolio error. Can you post the full script that generated it? My guess is that adding a RiskForecastError term with a small multiplier would fix it. Also changing cvxpy solver is worth a try...
I think this error relate to the frequency 'month'
I call the serve(t) function in the 1.0.1 version, and saw that the past return is sampled monthly, so the past return length is divided by about 30, and may be not long enough to calculate the covariance matrix
I think this error relate to the frequency 'month' I call the serve(t) function in the 1.0.1 version, and saw that the past return is sampled monthly, so the past return length is divided by about 30, and may be not long enough to calculate the covariance matrix
Thanks! You are right, with less history the covariance estimate is more noisy. My point though stays, you should just subtract some cvx.RiskForecastError() term to the objective to regularize it. Also, when you get solver errors, switching solver is always a good try.
Hi,
I am calculating returns for Dow 30 stocks - start from 01/01/2010 and get below errors.
If I change the start date to 01/01/2011, I get returns.
What am I doing wrong?
Thanks
V
trading_frequency = "monthly"
start_time = '2010-01-01'
end_time = '2016-12-31'
dow30_universe = ['MMM', 'AXP', 'AMGN', 'AAPL', 'BA', 'CAT', 'CVX', 'CSCO', 'KO', 'DIS', 'DOW', 'GS', 'HD', 'HON',
'IBM', 'INTC', 'JNJ',
'JPM', 'MCD', 'MRK', 'MSFT', 'NKE', 'PG', 'CRM', 'TRV', 'VZ', 'V', 'WBA', 'WMT']
Errors:
Traceback (most recent call last):
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxportfolio/policies.py", line 459, in _recursive_values_in_time
self.problem.solve(**self.cvxpy_kwargs)
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxpy/problems/problem.py", line 495, in solve
return solve_func(self, *args, **kwargs)
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxpy/problems/problem.py", line 1070, in _solve
self.unpack_results(solution, solving_chain, inverse_data)
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxpy/problems/problem.py", line 1395, in unpack_results
raise error.SolverError(
cvxpy.error.SolverError: Solver 'ECOS' failed. Try another solver, or solve with verbose=True for more information.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/venkatradha/PycharmProjects/pythonProject/main_yearly.py", line 199, in
esg_avg_weights, esg_avg_returns, esg_avg_annualized_return = get_weights_returns(esg_avg_universe)
File "/Users/venkatradha/PycharmProjects/pythonProject/main_yearly.py", line 24, in get_weights_returns
result = simulator.backtest(policy, start_time=start_time, end_time=end_time)
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxportfolio/simulator.py", line 668, in backtest
return self.backtest_many([policy], start_time=start_time, end_time=end_time,
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxportfolio/simulator.py", line 732, in backtest_many
result = list(starmap(self._worker, zip_args))
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxportfolio/simulator.py", line 640, in _worker
return simulator._concatenated_backtests(policy, start_time, end_time, h)
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxportfolio/simulator.py", line 600, in _concatenated_backtests
results.append(self._single_backtest(
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxportfolio/simulator.py", line 552, in _single_backtest
result.policy_times.loc[t] = self._simulate(
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxportfolio/simulator.py", line 479, in _simulate
z = policy._recursive_values_in_time(
File "/Users/venkatradha/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/cvxportfolio/policies.py", line 461, in _recursive_values_in_time
raise PortfolioOptimizationError(
cvxportfolio.errors.PortfolioOptimizationError: Numerical solver for policy MultiPeriodOptimization at time 2010-06-01 00:00:00 failed;try changing it, relaxing some constraints, or dropping some costs.
The text was updated successfully, but these errors were encountered: