From aac87ada5d0e9ab57a753af5844fcf5cf8a4cf4e Mon Sep 17 00:00:00 2001 From: Joe Jevnik Date: Mon, 17 Nov 2014 19:07:25 -0500 Subject: [PATCH] BUG: Ensure that the bar count is an integer in minutely mode simple transforms total_seconds can return a float, which when divided by `60` would still yield a float causing a value error when passed to range. --- zipline/protocol.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zipline/protocol.py b/zipline/protocol.py index 268770dd..488f3577 100644 --- a/zipline/protocol.py +++ b/zipline/protocol.py @@ -338,8 +338,9 @@ class SIDData(object): # 210 minutes in a an early close and 390 in a full day. ms = sum(210 if d in env.early_closes else 390 for d in ds) # Add the number of minutes for today. - ms += \ + ms += int( (now - env.get_open_and_close(now)[0]).total_seconds() / 60 + ) cls._minute_bar_cache[days] = ms + 1 # Account for this minute