diff --git a/tests/test_optimize.py b/tests/test_optimize.py index b3ff7b06..391cec51 100644 --- a/tests/test_optimize.py +++ b/tests/test_optimize.py @@ -110,7 +110,7 @@ class TestUpDown(TestCase): def test_concavity_of_returns(self): - """verify concave relationship between of free parameter and + """verify concave relationship between free parameter and returns in certain region around the max. Moreover, establishes that the max returns is at the correct value (i.e. 0). @@ -169,7 +169,7 @@ class TestUpDown(TestCase): idx[0] -= 1 idx[1] += 1 - @skip + #@skip def test_optimize(self): """verify that gradient descent (Powell's method) can find the optimal free parameter under which the BuySellAlgorithm produces @@ -200,7 +200,6 @@ class TestUpDown(TestCase): self.zipline_test_config['environment'] = trading_environment zipline = SimulatedTrading.create_test_zipline(**self.zipline_test_config) zipline.simulate(blocking=True) - zipline.shutdown() #function is getting minimized, so have to return negative cum returns. return -zipline.get_cumulative_performance()['returns'] diff --git a/zipline/optimize/factory.py b/zipline/optimize/factory.py index dc8295ce..fbb32f40 100644 --- a/zipline/optimize/factory.py +++ b/zipline/optimize/factory.py @@ -12,9 +12,9 @@ from zipline.finance.sources import SpecificEquityTrades from zipline.optimize.algorithms import BuySellAlgorithm from zipline.lines import SimulatedTrading from copy import deepcopy +from itertools import cycle def create_updown_trade_source(sid, trade_count, trading_environment, start_price, amplitude): - from itertools import cycle volume = 1000 events = [] price = start_price-amplitude/2.