mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-09 06:04:04 +08:00
Merge pull request #827 from quantopian/fix-asof-coercion
BUG: FutureChain's as_of() now properly coerces arguments
This commit is contained in:
@@ -961,6 +961,14 @@ class TestFutureChain(TestCase):
|
||||
pd.Timestamp(feb_prev, tz='UTC')
|
||||
)
|
||||
|
||||
# Test that the as_of() method works with str args
|
||||
feb_str = '2006-02-01'
|
||||
cl_feb = cl.as_of(feb_str)
|
||||
self.assertEqual(
|
||||
cl_feb.as_of_date,
|
||||
pd.Timestamp(feb, tz='UTC')
|
||||
)
|
||||
|
||||
# The chain as of the current dt should always be the same as
|
||||
# the defualt chain.
|
||||
self.assertEqual(cl[0], cl.as_of(pd.Timestamp('2005-12-01'))[0])
|
||||
|
||||
@@ -162,7 +162,7 @@ class FutureChain(object):
|
||||
asset_finder=self._asset_finder,
|
||||
get_datetime=self._algorithm_get_datetime,
|
||||
root_symbol=self.root_symbol,
|
||||
as_of_date=dt
|
||||
as_of_date=Timestamp(dt, tz='UTC'),
|
||||
)
|
||||
|
||||
def offset(self, time_delta):
|
||||
|
||||
Reference in New Issue
Block a user