Revert "Merge pull request #1340 from quantopian/by-daily-i-mean-minutely"

This reverts commit f4456719b0, reversing
changes made to 4be07e4628.
This commit is contained in:
Jean Bredeche
2016-07-26 16:20:14 -04:00
parent 52f3e91a4b
commit 2462929368
7 changed files with 40 additions and 65 deletions
+7 -21
View File
@@ -3731,18 +3731,12 @@ class TestEquityAutoClose(WithTmpDir, WithTradingCalendar, ZiplineTestCase):
transactions = output['transactions']
initial_fills = transactions.iloc[1]
self.assertEqual(len(initial_fills), len(assets))
last_minute_of_session = \
self.trading_calendar.open_and_close_for_session(
self.test_days[1]
)[1]
for sid, txn in zip(sids, initial_fills):
self.assertDictContainsSubset(
{
'amount': order_size,
'commission': None,
'dt': last_minute_of_session,
'dt': self.test_days[1],
'price': initial_fill_prices[sid],
'sid': sid,
},
@@ -3809,17 +3803,15 @@ class TestEquityAutoClose(WithTmpDir, WithTradingCalendar, ZiplineTestCase):
context.portfolio.cash == context.portfolio.starting_cash
)
today_session = self.trading_calendar.minute_to_session_label(
context.get_datetime()
)
now = context.get_datetime()
if today_session == first_asset_end_date:
if now == first_asset_end_date:
# Equity 0 will no longer exist tomorrow, so this order will
# never be filled.
assert len(context.get_open_orders()) == 0
context.order(context.sid(0), 10)
assert len(context.get_open_orders()) == 1
elif today_session == first_asset_auto_close_date:
elif now == first_asset_auto_close_date:
assert len(context.get_open_orders()) == 0
algo = TradingAlgorithm(
@@ -3837,18 +3829,12 @@ class TestEquityAutoClose(WithTmpDir, WithTradingCalendar, ZiplineTestCase):
original_open_orders = orders_for_date(first_asset_end_date)
assert len(original_open_orders) == 1
last_close_for_asset = \
algo.trading_calendar.open_and_close_for_session(
first_asset_end_date
)[1]
self.assertDictContainsSubset(
{
'amount': 10,
'commission': 0,
'created': last_close_for_asset,
'dt': last_close_for_asset,
'created': first_asset_end_date,
'dt': first_asset_end_date,
'sid': assets[0],
'status': ORDER_STATUS.OPEN,
'filled': 0,
@@ -3862,7 +3848,7 @@ class TestEquityAutoClose(WithTmpDir, WithTradingCalendar, ZiplineTestCase):
{
'amount': 10,
'commission': 0,
'created': last_close_for_asset,
'created': first_asset_end_date,
'dt': first_asset_auto_close_date,
'sid': assets[0],
'status': ORDER_STATUS.CANCELLED,