ENH: Adds last_available_{session, minute} args to DataPortal (#1528)

This allows optionally setting the last available dts in the DataPortal
explicitly. If these args aren't provided, we fall back to inferring
these from the underlying readers, which was the previous behavior.
This commit is contained in:
Andrew Daniels
2016-10-06 20:46:54 -04:00
committed by GitHub
parent b6f8a67aad
commit 2f097ead76
4 changed files with 44 additions and 7 deletions
+15 -4
View File
@@ -23,13 +23,14 @@ from zipline.assets import Equity
from zipline.testing.fixtures import (
ZiplineTestCase,
WithTradingSessions,
WithDataPortal
WithDataPortal,
alias,
)
class TestDataPortal(WithDataPortal,
WithTradingSessions,
ZiplineTestCase):
class DataPortalTestBase(WithDataPortal,
WithTradingSessions,
ZiplineTestCase):
ASSET_FINDER_EQUITY_SIDS = (1,)
START_DATE = pd.Timestamp('2016-08-01')
@@ -374,3 +375,13 @@ class TestDataPortal(WithDataPortal,
self.assertEqual(minutes[4], result,
"Asset 10000 had a trade on fourth minute, so should "
"return that as the last trade on the fifth.")
class TestDataPortal(DataPortalTestBase):
DATA_PORTAL_LAST_AVAILABLE_SESSION = None
DATA_PORTAL_LAST_AVAILABLE_MINUTE = None
class TestDataPortalExplicitLastAvailable(DataPortalTestBase):
DATA_PORTAL_LAST_AVAILABLE_SESSION = alias('START_DATE')
DATA_PORTAL_LAST_AVAILABLE_MINUTE = alias('END_DATE')