Make sure we are passing ints to nth.

This commit is contained in:
Jean Bredeche
2016-07-13 20:40:57 -04:00
parent 4af61d2c39
commit 3d6fdc0755
+2 -2
View File
@@ -412,7 +412,7 @@ class TradingDayOfWeekRule(six.with_metaclass(ABCMeta, StatelessRule)):
# calculate the list of periods that match the given criteria
return self.cal.schedule.groupby(
pd.Grouper(freq="W")
).nth(self.td_delta).index
).nth(int(self.td_delta)).index
def should_trigger(self, dt):
# is this market minute's period in the list of execution periods?
@@ -456,7 +456,7 @@ class TradingDayOfMonthRule(six.with_metaclass(ABCMeta, StatelessRule)):
# calculate the list of periods that match the given criteria
return self.cal.schedule.groupby(
pd.Grouper(freq="M")
).nth(self.td_delta).index
).nth(int(self.td_delta)).index
class NthTradingDayOfMonth(TradingDayOfMonthRule):