-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Multiple date ranges
#979
-
Hello, I would need to specify not only the direct strategy for buying/selling, but also evaluate whether when a specific condition arise that day belongs to one of preset date ranges.
Something like this:
df = pd.read_csv('data.csv')
# column 'Date' example '2023-05-06 00:00:00'
... Range1 = between 2023年01月01日 and 2023年01月10日
... Range2 = between 2023年01月21日 and 2023年01月20日
... Range3 = between 2023年02月01日 and 2023年02月10日
class Test(Strategy):
...
def next(self):
if crossover(self.testA1, self.testA2) and ... 'Date' within Range1 or Range2 or Range3
self.position.close()
self.buy()
elif crossover(self.testB1, self.testB2) and ... 'Date' NOT within Range1 or Range2 or Range3
self.position.close()
self.buy()
elif ...
Thank you
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment