Exemplo n.º 1
0
 def init(context):
     trading_dates_list = get_trading_dates('2016-12-15', '2017-01-03')
     correct_dates_list = [datetime.date(2016, 12, 15), datetime.date(2016, 12, 16), datetime.date(2016, 12, 19),
                           datetime.date(2016, 12, 20), datetime.date(2016, 12, 21), datetime.date(2016, 12, 22),
                           datetime.date(2016, 12, 23), datetime.date(2016, 12, 26), datetime.date(2016, 12, 27),
                           datetime.date(2016, 12, 28), datetime.date(2016, 12, 29), datetime.date(2016, 12, 30),
                           datetime.date(2017, 1, 3)]
     assert sorted([item.strftime("%Y%m%d") for item in correct_dates_list]) == sorted(
         [item.strftime("%Y%m%d") for item
          in trading_dates_list])
Exemplo n.º 2
0
 def handle_bar(context, bar_dict):
     trading_dates_list = get_trading_dates('2016-12-15', '2017-01-03')
     correct_dates_list = [datetime.date(2016, 12, 15), datetime.date(2016, 12, 16), datetime.date(2016, 12, 19),
                           datetime.date(2016, 12, 20), datetime.date(2016, 12, 21), datetime.date(2016, 12, 22),
                           datetime.date(2016, 12, 23), datetime.date(2016, 12, 26), datetime.date(2016, 12, 27),
                           datetime.date(2016, 12, 28), datetime.date(2016, 12, 29), datetime.date(2016, 12, 30),
                           datetime.date(2017, 1, 3)]
     assert sorted([item.strftime("%Y%m%d") for item in correct_dates_list]) == sorted(
         [item.strftime("%Y%m%d") for item
          in trading_dates_list])