def test_jpx_closes_at_lunch(): jpx_calendar = JPXExchangeCalendar() jpx_schedule = jpx_calendar.schedule( start_date=datetime.datetime(2015, 1, 14, tzinfo=pytz.timezone('Asia/Tokyo')), end_date=datetime.datetime(2015, 1, 16, tzinfo=pytz.timezone('Asia/Tokyo'))) assert jpx_calendar.open_at_time(schedule=jpx_schedule, timestamp=datetime.datetime( 2015, 1, 14, 11, 0, tzinfo=pytz.timezone('Asia/Tokyo'))) assert not jpx_calendar.open_at_time( schedule=jpx_schedule, timestamp=datetime.datetime( 2015, 1, 14, 12, 0, tzinfo=pytz.timezone('Asia/Tokyo')))
def test_jpx_correctly_counts_jpx_vernal_equinox(): jpx_calendar = JPXExchangeCalendar() jpx_schedule = jpx_calendar.schedule(start_date='2017-03-01', end_date='2019-09-30') assert pd.Timestamp('2017-03-20') not in jpx_schedule.index assert pd.Timestamp('2017-03-21') in jpx_schedule.index assert pd.Timestamp('2018-03-21') not in jpx_schedule.index assert pd.Timestamp('2019-03-21') not in jpx_schedule.index assert pd.Timestamp('2019-03-20') in jpx_schedule.index
def test_jpx_correctly_counts_jpx_autumn_equinox(): jpx_calendar = JPXExchangeCalendar() jpx_schedule = jpx_calendar.schedule(start_date='2016-09-01', end_date='2019-09-30') assert pd.Timestamp('2016-09-22') not in jpx_schedule.index assert pd.Timestamp('2016-09-23') in jpx_schedule.index assert pd.Timestamp( '2017-09-23') not in jpx_schedule.index # EQUINOX Saturday assert pd.Timestamp('2017-09-24') not in jpx_schedule.index # Sunday assert pd.Timestamp('2017-09-25') in jpx_schedule.index # Monday assert pd.Timestamp('2018-09-22') not in jpx_schedule.index # Saturday assert pd.Timestamp( '2018-09-23') not in jpx_schedule.index # EQUINOX Sunday assert pd.Timestamp('2018-09-24') not in jpx_schedule.index # Equinox OBS assert pd.Timestamp('2019-09-22') not in jpx_schedule.index # Sunday assert pd.Timestamp('2019-09-23') not in jpx_schedule.index # EQUINOX assert pd.Timestamp('2019-09-24') in jpx_schedule.index # Monday