mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-21 12:30:16 +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:
@@ -475,7 +475,9 @@ class BcolzMinuteBarTestCase(TestCase):
|
||||
self.assertEqual(last_date, TEST_CALENDAR_START)
|
||||
|
||||
freq = self.market_opens.index.freq
|
||||
minute = self.market_opens[TEST_CALENDAR_START + freq]
|
||||
day = TEST_CALENDAR_START + freq
|
||||
minute = self.market_opens[day]
|
||||
|
||||
data = DataFrame(
|
||||
data={
|
||||
'open': [15.0],
|
||||
@@ -507,6 +509,15 @@ class BcolzMinuteBarTestCase(TestCase):
|
||||
|
||||
self.assertEquals(100.0, volume_price)
|
||||
|
||||
# Check that if we then pad the rest of this day, we end up with
|
||||
# 2 days worth of minutes.
|
||||
self.writer.pad(sid, day)
|
||||
|
||||
self.assertEqual(
|
||||
len(self.writer._ensure_ctable(sid)),
|
||||
self.writer._minutes_per_day * 2,
|
||||
)
|
||||
|
||||
def test_nans(self):
|
||||
"""
|
||||
Test writing empty data.
|
||||
|
||||
Reference in New Issue
Block a user