from pandas import DataFrame, Series from daily_data import get_daily_data def signals(data: DataFrame) -> Series: """ Generate long signals based on the Connors VIX Reversal 3 strategy. Returns a Series with 'L' for long signals and 'N' for no signal. """ start_date = data['Date'].min() end_date = data['Date'].max() vix_data = get_daily_data(symbol = 'VIX.XO', start_date = start_date, end_date = end_date) vix_ma_50 = vix_data['Close'].rolling(window = 50).mean() vix_low_above_50_ma = vix_data['Low'] > vix_ma_50 vix_close_10_percent_above_ma = vix_data['Close'] >= (1.1 * vix_ma_50) signals = Series('N', index = data.index) signals[vix_low_above_50_ma & vix_close_10_percent_above_ma] = 'L' return signals