mirror of
https://github.com/wassname/catalyst.git
synced 2026-09-09 11:19:23 +08:00
BUG: Fixes bcolz padding to not always pad 390 minutes
If minutes already exist for the last existing day, adjust the number of minutes padded to account for them. Previously we would always pad 390, leading to a mismatch in the number of rows.
This commit is contained in:
@@ -393,7 +393,12 @@ class BcolzMinuteBarWriter(object):
|
||||
return bcolz.ctable(rootdir=sidpath, mode='a')
|
||||
|
||||
def _zerofill(self, table, numdays):
|
||||
num_to_prepend = numdays * self._minutes_per_day
|
||||
# Compute the number of minutes to be filled, accounting for the
|
||||
# possibility of a partial day's worth of minutes existing for
|
||||
# the previous day.
|
||||
minute_offset = len(table) % self._minutes_per_day
|
||||
num_to_prepend = numdays * self._minutes_per_day - minute_offset
|
||||
|
||||
prepend_array = np.zeros(num_to_prepend, np.uint32)
|
||||
# Fill all OHLCV with zeros.
|
||||
table.append([prepend_array] * 5)
|
||||
|
||||
Reference in New Issue
Block a user