INNER CODE UNIT · Python
symmetry_looking
firmai/deltapy · deltapy/extract.py:132
def symmetry_looking(x, param=[{"r": 0.2}]):
if not isinstance(x, (np.ndarray, pd.Series)):
x = np.asarray(x)
mean_median_difference = np.abs(np.mean(x) - np.median(x))
max_min_difference = np.max(x) - np.min(x)
return [("r_{}".format(r["r"]), mean_median_difference < (r["r"] * max_min_difference))
for r in param]
# symmetry_looking(df["Close"])
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#-> In Package
def has_duplicate_max(x):
"""
Checks if the maximum value of x is observed more than once