Ejemplo n.º 1
0
def get_trading_calendar(security_type='future', exchange='shfe'):
    the_path = get_exchange_trading_calendar_path(security_type, exchange)

    trading_dates = []
    if os.path.exists(the_path):
        with open(the_path) as data_file:
            trading_dates = json.load(data_file)
    return trading_dates
    def spider_closed(self, spider, reason):
        if self.trading_dates:
            if self.saved_trading_dates:
                self.trading_dates.append(self.saved_trading_dates)
            result_list = drop_duplicate(self.trading_dates)
            result_list = sorted(result_list)

            the_path = get_exchange_trading_calendar_path('future', 'shfe')
            with open(the_path, 'w') as outfile:
                json.dump(result_list, outfile)

        spider.logger.info('Spider closed: %s,%s\n', spider.name, reason)