diff --git a/tests/test_assets.py b/tests/test_assets.py index eeecd487..9fed193f 100644 --- a/tests/test_assets.py +++ b/tests/test_assets.py @@ -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]) diff --git a/zipline/assets/futures.py b/zipline/assets/futures.py index 9e71bd6a..12dcae52 100644 --- a/zipline/assets/futures.py +++ b/zipline/assets/futures.py @@ -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):