Consider removing the commented out code block
956
957 alpha = df["returns"].mean() - beta * df["benchmark"].mean()
958
959 # alpha = alpha * periods 960 return _pd.DataFrame(index=returns.index, data={"beta": beta, "alpha": alpha})
961
962
Consider removing the commented out code block
887
888def r_squared(returns, benchmark, prepare_returns=True):
889 """Measures the straight line fit of the equity curve"""
890 # slope, intercept, r_val, p_val, std_err = _linregress( 891 if prepare_returns:
892 returns = _utils._prepare_returns(returns)
893 _, _, r_val, _, _ = _linregress(
Consider removing the commented out code block
259 if isinstance(returns, _pd.DataFrame):
260 returns = returns[returns.columns[0]]
261
262 # returns.to_csv('/Users/ran/Desktop/test.csv') 263 num = len(returns)
264 coef = _np.abs(_np.corrcoef(returns[:-1], returns[1:])[0, 1])
265 corr = [((num - x) / num) * coef**x for x in range(1, num)]
Description
It is recommended to remove any commented code in your codebase.
Bad practice
for item in sequence:
# print(item)
do_something(item)
# def old_function():
# '''Older implementation that has been replaced'''
# data = get_data()
# api.post(data)
Recommended
for item in sequence:
do_something(item)