2024-10-28 17:51:21 +00:00
|
|
|
from pandas import DataFrame, Series
|
|
|
|
|
|
|
|
def signals(data: DataFrame) -> Series:
|
|
|
|
"""
|
|
|
|
Calculate the End of Month (EOM) signal.
|
|
|
|
Returns a Series with 'L' for long signals if the date is close to the end of the month and 'N' otherwise.
|
|
|
|
"""
|
2024-10-30 07:22:52 +00:00
|
|
|
return data['Date'].apply(lambda x: 'L' if x.day in [23, 24, 25, 26, 27] else 'N')
|