add account object to context

This commit is contained in:
Brian Fink
2014-10-10 17:10:45 -04:00
parent df234f516c
commit 50c5b73a7b
9 changed files with 201 additions and 3 deletions
+19
View File
@@ -34,6 +34,7 @@ from zipline.errors import (
TradingControlViolation,
)
from zipline.test_algorithms import (
access_account_in_init,
access_portfolio_in_init,
AmbitiousStopLimitAlgorithm,
EmptyPositionsAlgorithm,
@@ -687,6 +688,24 @@ def handle_data(context, data):
output, _ = drain_zipline(self, zipline)
def test_account_in_init(self):
"""
Test that accessing account in init doesn't break.
"""
test_algo = TradingAlgorithm(
script=access_account_in_init,
sim_params=self.sim_params,
)
set_algo_instance(test_algo)
self.zipline_test_config['algorithm'] = test_algo
self.zipline_test_config['trade_count'] = 1
zipline = simfactory.create_test_zipline(
**self.zipline_test_config)
output, _ = drain_zipline(self, zipline)
class TestHistory(TestCase):
def test_history(self):