Merge branch 'optimize_qexec' of github.com:quantopian/zipline

This commit is contained in:
Thomas Wiecki
2012-05-28 11:25:22 -04:00
2 changed files with 6 additions and 6 deletions
+2 -3
View File
@@ -39,7 +39,6 @@ class TestUpDown(TestCase):
'sid':133 'sid':133
} }
@skip
@timed(DEFAULT_TIMEOUT) @timed(DEFAULT_TIMEOUT)
def test_source_and_orders(self): def test_source_and_orders(self):
"""verify that UpDownSource is having the correct """verify that UpDownSource is having the correct
@@ -108,8 +107,8 @@ class TestUpDown(TestCase):
self.assertTrue(np.all(min_order_idx == min_price_idx), self.assertTrue(np.all(min_order_idx == min_price_idx),
"Algorithm did not sell when price was going to increase." "Algorithm did not sell when price was going to increase."
) )
@skip
def test_concavity_of_returns(self): def test_concavity_of_returns(self):
"""verify concave relationship between of free parameter and """verify concave relationship between of free parameter and
returns in certain region around the max. Moreover, returns in certain region around the max. Moreover,
+4 -3
View File
@@ -7,10 +7,11 @@ from datetime import datetime, timedelta
import zipline.protocol as zp import zipline.protocol as zp
from zipline.utils.factory import get_next_trading_dt from zipline.utils.factory import get_next_trading_dt, create_trading_environment
from zipline.finance.sources import SpecificEquityTrades from zipline.finance.sources import SpecificEquityTrades
from zipline.optimize.algorithms import BuySellAlgorithm from zipline.optimize.algorithms import BuySellAlgorithm
from zipline.lines import SimulatedTrading from zipline.lines import SimulatedTrading
from copy import deepcopy
def create_updown_trade_source(sid, trade_count, trading_environment, start_price, amplitude): def create_updown_trade_source(sid, trade_count, trading_environment, start_price, amplitude):
from itertools import cycle from itertools import cycle
@@ -41,7 +42,7 @@ def create_updown_trade_source(sid, trade_count, trading_environment, start_pric
trading_environment.period_end = cur trading_environment.period_end = cur
source = SpecificEquityTrades(sid, events) source = SpecificEquityTrades("updown_" + str(sid), events)
return source return source
@@ -55,7 +56,7 @@ def create_predictable_zipline(config, sid=133, amplitude=10, base_price=50, off
base_price, base_price,
amplitude) amplitude)
algo = RegularIntervalBuySellAlgorithm(sid, 100, offset) algo = BuySellAlgorithm(sid, 100, offset)
config['algorithm'] = algo config['algorithm'] = algo
config['trade_source'] = source config['trade_source'] = source
config['environment'] = trading_environment config['environment'] = trading_environment