diff --git a/tests/test_monitor.py b/tests/test_monitor.py index 5da84b2a..8b670356 100644 --- a/tests/test_monitor.py +++ b/tests/test_monitor.py @@ -4,7 +4,6 @@ from unittest2 import TestCase, skip from zipline.core.monitor import Controller - class TestMonitor(TestCase): def setUp(self): self.log_handler = LoggingHandler() diff --git a/zipline/components/tradesimulation.py b/zipline/components/tradesimulation.py index a110087c..b1a4ff53 100644 --- a/zipline/components/tradesimulation.py +++ b/zipline/components/tradesimulation.py @@ -180,8 +180,6 @@ class TradeSimulationClient(Component): - Set the current portfolio for the algorithm as per protocol. - Construct data based on backlog of events, send to algorithm. """ - # current_portfolio = self.perf.get_portfolio() - # self.algorithm.set_portfolio(current_portfolio) data = self.get_data() if len(data) > 0: diff --git a/zipline/test_algorithms.py b/zipline/test_algorithms.py index 7d33bf13..56788c49 100644 --- a/zipline/test_algorithms.py +++ b/zipline/test_algorithms.py @@ -138,17 +138,55 @@ class NoopAlgorithm(object): def get_sid_filter(self): return None +class ExceptionAlgorithm(object): + """ + Dolce fa niente. + """ + + def __init__(self, throw_from): + self.throw_from == throw_from + + def initialize(self): + if self.throw_from == "initialize": + raise Exception("Algo exception in initialize") + else: + pass + + def set_order(self, order_callable): + if self.throw_from == "set_order": + raise Exception("Algo exception in set_order") + else: + pass + + def set_portfolio(self, portfolio): + if self.throw_from == "set_portfolio": + raise Exception("Algo exception in set_portfolio") + else: + pass + + def handle_data(self, data): + if self.throw_from == "handle_data": + raise Exception("Algo exception in handle_data") + else: + pass + + def get_sid_filter(self): + if self.throw_from == "get_sid_filter": + raise Exception("Algo exception in get_sid_filter") + else: + return None + class TestPrintAlgorithm(): def __init__(self): pass - + def initialize(self): print "Initializing..." def set_order(self, order_callable): pass - + def set_portfolio(self, portfolio): pass