mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-11 11:57:36 +08:00
Moved cycle import out of function.
This commit is contained in:
@@ -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']
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user