def _synch(symbols): if not symbols: return () print('stocks history synch:', lib.tty.bold + str(len(symbols)) + lib.tty.reset) failed = [] progress = lib.util.progress.Progress(len(symbols)) handler = lib.synch.handler.History() for symbol in symbols: if not handler.synch(symbol): failed.append(symbol) progress.update() if failed: lib.tty.error('failed symbols', lib.tty.bold + ' '.join(failed) + lib.tty.reset)
def _synch(collection, meta): print(meta, 'meta synch:', lib.tty.bold + str(len(collection)) + lib.tty.reset) children = [] failed = [] progress = lib.util.progress.Progress(len(collection)) handler = lib.synch.handler.Meta() for symbol in collection: if not handler.synch(symbol): failed.append(symbol) else: children.extend(handler.children) progress.update() if failed: lib.tty.error('failed symbols', lib.tty.bold + ' '.join(failed) + lib.tty.reset) return children