📅  最后修改于: 2022-03-11 14:46:37.753000             🧑  作者: Mango
def roll(df):
bear_fractal = df['high'].rolling(5, center=True).apply(lambda x: x[2] == max(x), raw=True)
bull_fractal = df['low'].rolling(5, center=True).apply(lambda x: x[2] == min(x), raw=True)
return bear_fractal, bull_fractal