(series, step=50)
| 22 | return [s for s in string_list if s in main_string] |
| 23 | |
| 24 | def calculate_log_returns(series, step=50): |
| 25 | return np.log(series / series.shift(step)).dropna().reset_index(drop=True) |
| 26 | |
| 27 | def optimized_rolling_diff(series, window_size): |
| 28 | return series.rolling(window=window_size).apply(lambda x: x.iloc[-1] - x.iloc[0], raw=False).shift(-(window_size - 1)) |