mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-05 09:22:04 +08:00
changing the calendar test for lse to use the last available date
rather than the end date.
This commit is contained in:
@@ -68,18 +68,18 @@ class TestTradingCalendar(TestCase):
|
||||
env_start_index = \
|
||||
env.trading_days.searchsorted(tradingcalendar_lse.start)
|
||||
env_days = env.trading_days[env_start_index:]
|
||||
diff = env_days - tradingcalendar_lse.trading_days
|
||||
end_index = \
|
||||
tradingcalendar_lse.trading_days.searchsorted(env.trading_days[-1])
|
||||
# pandas series slicing is different.
|
||||
cal_days = tradingcalendar_lse.trading_days[:end_index+1]
|
||||
diff = env_days - cal_days
|
||||
self.assertEqual(
|
||||
len(diff),
|
||||
0,
|
||||
"{diff} should be empty".format(diff=diff)
|
||||
)
|
||||
|
||||
diff2 = tradingcalendar_lse.trading_days - env_days
|
||||
# depending on the time of day, data for the current day
|
||||
# may not be available from yahoo, so don't include end
|
||||
# of the tradingcalendar
|
||||
diff2 = diff2 - self.end
|
||||
diff2 = cal_days - env_days
|
||||
self.assertEqual(
|
||||
len(diff2),
|
||||
0,
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
import pandas as pd
|
||||
import pytz
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import datetime
|
||||
from dateutil import rrule
|
||||
from delorean import Delorean
|
||||
|
||||
start = datetime(1990, 1, 1, tzinfo=pytz.utc)
|
||||
end_dln = Delorean(datetime.now() - timedelta(days=1), 'US/Eastern')
|
||||
end_dln.truncate('day').shift('UTC')
|
||||
end_dln = Delorean(datetime.now(), 'US/Eastern')
|
||||
end_dln.shift('UTC').truncate('day')
|
||||
end = end_dln.datetime
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user