From c2b2d00beb4bcf1f9f6192198b4966f1496751df Mon Sep 17 00:00:00 2001 From: moshferatu Date: Mon, 28 Oct 2024 10:51:21 -0700 Subject: [PATCH] Add script for generating end of month swing trading signals --- strategies/end_of_month.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 strategies/end_of_month.py diff --git a/strategies/end_of_month.py b/strategies/end_of_month.py new file mode 100644 index 0000000..f1213a6 --- /dev/null +++ b/strategies/end_of_month.py @@ -0,0 +1,8 @@ +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. + """ + return data['Date'].apply(lambda x: 'L' if x.day in [24, 25, 26] else 'N') \ No newline at end of file