mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-28 22:02:05 +08:00
Merge branch 'optimize_qexec' of github.com:quantopian/zipline
This commit is contained in:
@@ -39,7 +39,6 @@ class TestUpDown(TestCase):
|
||||
'sid':133
|
||||
}
|
||||
|
||||
@skip
|
||||
@timed(DEFAULT_TIMEOUT)
|
||||
def test_source_and_orders(self):
|
||||
"""verify that UpDownSource is having the correct
|
||||
@@ -108,8 +107,8 @@ class TestUpDown(TestCase):
|
||||
self.assertTrue(np.all(min_order_idx == min_price_idx),
|
||||
"Algorithm did not sell when price was going to increase."
|
||||
)
|
||||
|
||||
@skip
|
||||
|
||||
|
||||
def test_concavity_of_returns(self):
|
||||
"""verify concave relationship between of free parameter and
|
||||
returns in certain region around the max. Moreover,
|
||||
|
||||
@@ -7,10 +7,11 @@ from datetime import datetime, timedelta
|
||||
|
||||
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.optimize.algorithms import BuySellAlgorithm
|
||||
from zipline.lines import SimulatedTrading
|
||||
from copy import deepcopy
|
||||
|
||||
def create_updown_trade_source(sid, trade_count, trading_environment, start_price, amplitude):
|
||||
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
|
||||
|
||||
source = SpecificEquityTrades(sid, events)
|
||||
source = SpecificEquityTrades("updown_" + str(sid), events)
|
||||
|
||||
return source
|
||||
|
||||
@@ -55,7 +56,7 @@ def create_predictable_zipline(config, sid=133, amplitude=10, base_price=50, off
|
||||
base_price,
|
||||
amplitude)
|
||||
|
||||
algo = RegularIntervalBuySellAlgorithm(sid, 100, offset)
|
||||
algo = BuySellAlgorithm(sid, 100, offset)
|
||||
config['algorithm'] = algo
|
||||
config['trade_source'] = source
|
||||
config['environment'] = trading_environment
|
||||
|
||||
Reference in New Issue
Block a user