Merge pull request #827 from quantopian/fix-asof-coercion

BUG: FutureChain's as_of() now properly coerces arguments
This commit is contained in:
James Kirk
2015-11-10 14:18:27 -05:00
2 changed files with 9 additions and 1 deletions
+8
View File
@@ -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])
+1 -1
View File
@@ -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):