Fixed odd bug that caused the first day not to get simulated. This triggered some changes to the batchtransform unittests.

This commit is contained in:
Thomas Wiecki
2012-10-23 15:47:38 -04:00
committed by Eddie Hebert
parent 42c2a6b892
commit c0b161287d
2 changed files with 8 additions and 5 deletions
+5 -4
View File
@@ -329,17 +329,17 @@ class BatchTransformTestCase(TestCase):
for test_history in [algo.history_return_price_class,
algo.history_return_price_decorator]:
np.testing.assert_array_equal(
range(4, 10),
range(2, 8),
test_history[2].values.flatten()
)
np.testing.assert_array_equal(
range(4, 10),
range(2, 8),
test_history[3].values.flatten()
)
np.testing.assert_array_equal(
range(6, 14),
range(4, 12),
test_history[4].values.flatten()
)
@@ -352,4 +352,5 @@ class BatchTransformTestCase(TestCase):
expected_item = ((1, ), {'kwarg': 'str'})
self.assertEqual(
algo.history_return_args,
[None, None, expected_item, expected_item, expected_item])
[None, None, expected_item, expected_item,
expected_item, expected_item])
+3 -1
View File
@@ -132,7 +132,9 @@ class AlgorithmSimulator(object):
self.order_book = order_book
self.algo = algo
self.algo_start = algo_start
self.algo_start = algo_start.replace(hour=0, minute=0,
second=0,
microsecond=0)
# Monkey patch the user algorithm to place orders in the
# TransactionSimulator's order book and use our logger.