diff --git a/tests/test_components.py b/tests/test_components.py index de6c0248..8f1099b7 100644 --- a/tests/test_components.py +++ b/tests/test_components.py @@ -292,7 +292,7 @@ class ComponentTestCase(TestCase): BT_UPDATE_UNFRAME, "tsc" ) - + import nose.tools; nose.tools.set_trace() mon_proc = launch_monitor(monitor) for message in tsc_comp: log.info(pf(message)) diff --git a/zipline/gens/tradesimulation.py b/zipline/gens/tradesimulation.py index 522d80da..05f85c5a 100644 --- a/zipline/gens/tradesimulation.py +++ b/zipline/gens/tradesimulation.py @@ -117,7 +117,7 @@ class AlgorithmSimulator(object): # Monkey patch the user algorithm to place orders in the # TransactionSimulator's order book. self.algo.set_order(self.order) - self.algo.set_logger(logbook.Logger("Algolog")) + self.algo.set_logger(logbook.Logger("AlgoLog")) # Call the user's initialize method. self.algo.initialize() diff --git a/zipline/lines.py b/zipline/lines.py index bf68bd9e..0f17725f 100644 --- a/zipline/lines.py +++ b/zipline/lines.py @@ -81,9 +81,9 @@ from logbook import Logger, NestedSetup, Processor import zipline.protocol as zp - log = Logger('Lines') + class CancelSignal(Exception): def __init__(self): pass @@ -102,9 +102,8 @@ class SimulatedTrading(object): self.date_sorted = date_sorted_sources(*sources) self.transforms = transforms - self.transforms.append(StatefulTransform(Passthrough)) # Formerly merged_transforms. - self.with_tnfms = sequential_transforms(self.date_sorted, *self.transforms) + self.with_tnfms = sequential_transforms(self.date_sorted, *self.transforms) self.trading_client = tsc(algorithm, environment, style) self.gen = self.trading_client.simulate(self.with_tnfms) self.results_uri = results_socket_uri @@ -153,9 +152,9 @@ class SimulatedTrading(object): def stream_results(self): assert self.results_socket, \ - "Results socket must exist to stream results" + "Results socket must exist to stream results" try: - for event in self.gen: + for event in self.gen: if event.has_key('daily_perf'): msg = zp.PERF_FRAME(event) else: @@ -218,7 +217,6 @@ class SimulatedTrading(object): except: log.exception("Exception while reporting simulation exception.") - def open(self): if not self.context: self.context = zmq.Context() @@ -228,11 +226,11 @@ class SimulatedTrading(object): self.results_socket = sock self.setup_logging() - def setup_logging(self, socket = None): - sock = socket or self.results_socket + def setup_logging(self): + assert self.results_socket self.zmq_out = ZeroMQLogHandler( - socket = sock, + socket = self.results_socket, ) @@ -275,7 +273,6 @@ class SimulatedTrading(object): of StatefulTransform objects. """ assert isinstance(config, dict) - sid = config['sid'] #-------------------- diff --git a/zipline/utils/factory.py b/zipline/utils/factory.py index 1b881329..e3d92443 100644 --- a/zipline/utils/factory.py +++ b/zipline/utils/factory.py @@ -213,7 +213,6 @@ def create_minutely_trade_source(sids, trade_count, trading_environment): def create_trade_source(sids, trade_count, trade_time_increment, trading_environment): - #Set up source a. One minute between events. args = tuple() kwargs = { 'count' : trade_count,