def verify_download(self, data_contexts): for data, context in data_contexts: if 'error' in context and context['error']: FailedSymbols.add_failed(context['symbol'], context['error']) continue else: yield data, context
def verify_download(self, data, context): rows = data.strip().split('\n') idx = 15 if len(rows) > 15 else len(rows) for i, row in enumerate(rows[:idx]): if row.startswith('error'): FailedSymbols.add_failed(context['symbol'], rows[i + 1][len('message:'):]) return False return True
def verify_download(self, data, context): rows = data.strip().split('\n') idx = 15 if len(rows) > 15 else len(rows) for i, row in enumerate(rows[:idx]): if row.startswith('error'): FailedSymbols.add_failed(context['symbol'], rows[i+1][len('message:'):]) return False return True
def __verify_bar(self, symbol, bar_, i): if isinstance(bar_, str): line_number = '%i' % (i + 2) # +1 for the header row and +1 because i is 0-indexed if symbol not in FailedSymbols: FailedSymbols.add_failed(symbol, {line_number: bar_}) else: previous_errors = FailedSymbols.get_error(symbol) previous_errors.update({line_number: bar_}) FailedSymbols.add_failed(symbol, previous_errors) return False return True
def __verify_symbol_stats(self, symbol_key_stats): error = symbol_key_stats.pop('ErrorIndicationreturnedforsymbolchangedinvalid') if error: if 'No such ticker symbol' in error: error = 'No such ticker symbol.' elif 'Ticker symbol has changed to' in error: new_symbol = error.strip()[:-1] new_symbol = new_symbol[new_symbol.rfind('>')+1:new_symbol.rfind('<')] error = 'Ticker symbol has changed to %s.' % new_symbol FailedSymbols.add_failed(symbol_key_stats['Symbol'], error) return False return True
def __verify_bar(self, symbol, bar_, i): if isinstance(bar_, str): line_number = '%i' % ( i + 2) # +1 for the header row and +1 because i is 0-indexed if symbol not in FailedSymbols: FailedSymbols.add_failed(symbol, {line_number: bar_}) else: previous_errors = FailedSymbols.get_error(symbol) previous_errors.update({line_number: bar_}) FailedSymbols.add_failed(symbol, previous_errors) return False return True