Skip to content

Commit

Permalink
flake8 jealous#2
Browse files Browse the repository at this point in the history
  • Loading branch information
jhmenke committed Nov 2, 2021
1 parent 6a9054d commit d1c4167
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions stockstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,9 @@ def _get_mfi(cls, df, n_days=None):
@classmethod
def _get_kama(cls, df, column, windows, fasts=5, slows=34):
""" get Kaufman's Adaptive Moving Average.
Implemented after https://school.stockcharts.com/doku.php?id=technical_indicators:kaufman_s_adaptive_moving_average
Implemented after
'https://school.stockcharts.com/doku.php?id=technical_
indicators:kaufman_s_adaptive_moving_average'
:param df: data
:param column: column to calculate
Expand All @@ -951,8 +953,9 @@ def _get_kama(cls, df, column, windows, fasts=5, slows=34):
df[column_name] = 0.
for i in range(window, df.shape[0]):
last_kama = df.loc[df.index[i-1], column_name]
summand = smoothing_constant.iloc[i] \
* (df.loc[df.index[i], column] - last_kama)
summand = smoothing_constant.iloc[i] * (df.loc[df.index[i],
column]
- last_kama)
df.loc[df.index[i], column_name] = last_kama + summand
df.loc[efficiency_ratio.isnull(), column_name] = np.nan
else:
Expand Down Expand Up @@ -1092,7 +1095,8 @@ def __init_not_exist_column(cls, df, key):
getattr(cls, func_name)(df, r)
else:
raise UserWarning("Invalid number of return arguments "
"after parsing column name: '{}'".format(key))
"after parsing column name: '{}'"
.format(key))

@staticmethod
def __init_column(df, key):
Expand Down

0 comments on commit d1c4167

Please sign in to comment.