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
{{ message }}
Repository navigation
[BUG] CLA crashes with TypeError and produces non-deterministic results when expected returns are equal #738
CLA.max_sharpe() raises TypeError: '>' not supported between instances of 'NoneType' and 'float' when all expected returns are equal.
The root cause is that _compute_lambda explicitly returns (None, None) when its denominator c is exactly zero:
ifc==0:
returnNone, None
When all expected returns are equal, c = 0 is mathematically guaranteed — the term that distinguishes assets by return cancels out exactly. The calling loop in _solve does not guard against this None before using lam in a comparison:
_infnone is applied to the accumulated l_out but not to the local lam returned from each _compute_lambda call, causing the TypeError.
Expected behavior
Either a deterministic valid result — falling through to the minimum variance portfolio, which remains well-defined when returns are equal — or an informative ValueError explaining that max_sharpe is undefined when all expected returns are identical.
Activity