def main(): parser = argparse.ArgumentParser() parser.add_argument('stock_codes', nargs='*', help="股票代號") args = parser.parse_args() stock_codes = args.stock_codes #print(stock_codes) retriever = Retriever(stock_codes) retriever.put_mapping_by_stock_codes() retriever.dump_to_es()
def main(): retriever = Retriever() data_dir = retriever.data_dir file_list = (f for f in listdir(data_dir) if search_filename(f) is not None and int(search_filename(f).group(1)) > 3708) for filename in file_list: print(filename) search_stock_code = re.search('(\w+).csv$', filename) stock_code = search_stock_code.group(1) stock_codes = [stock_code] retriever.put_mapping_by_stock_codes() retriever.dump_to_es()