from pandas import DataFrame, Series from ohlc import ohlc def signals(data: DataFrame) -> Series: """ Generate long signals based on the VIX 15-day high strategy. Returns a Series with 'L' for long signals and 'N' for no signal. """ ma_200 = data['Close'].rolling(window = 200).mean() above_200_ma = data['Close'] > ma_200 start_date = data['Date'].min() end_date = data['Date'].max() vix_data = ohlc(symbol='VIX.XO', start_date=start_date, end_date=end_date) vix_15_day_high = vix_data['High'] == vix_data['High'].rolling(window = 15).max() vix_close_below_open = vix_data['Close'] < vix_data['Open'] signals = Series('N', index = data.index) signals[above_200_ma & vix_15_day_high & vix_close_below_open] = 'L' return signals