if dot_invs_py_exists: print('Using {} as Investing.com database file.'.format(dot_invs_py)) invs_db_file = dot_invs_py else: print('--invs is required !!') sys.exit(-1) # endif else: print('Using {} as Investing.com database file.'.format(args.__dict__['invs'])) invs_db_file = args.__dict__['invs'] # Copy the passed file to dot_invs_py print('Copying {} to {} ..'.format(invs_db_file, dot_invs_py)) shutil.copyfile(os.path.expanduser(invs_db_file), os.path.expanduser(dot_invs_py)) # endif if not args.__dict__['sfile']: print('--sfile is required !! It should be one of supported types : {}'.format(invs_parsers.populate_sec_list(None))) sys.exit(-1) # endif # Vars invs_db_f = os.path.expanduser(invs_db_file) sec_file = args.__dict__['sfile'] invs_res = args.__dict__['res'] out_dir = args.__dict__['odir'] verbose = args.__dict__['verbose'] sec_tick_d = invs_parsers.populate_sym_list_from_sec_file(invs_db_f, sec_file) run_csv_gen(sec_tick_d, invs_res=invs_res, output_dir=args.__dict__['odir'], verbose=verbose) # endif
sys.exit(-1) # endif else: print('Using {} as Zerodha Kite database file.'.format( args.__dict__['instr'])) kis_db_file = args.__dict__['instr'] # Copy the passed file to dot_invs_py print('Copying {} to {} ..'.format(kis_db_file, dot_kis)) shutil.copyfile(os.path.expanduser(kis_db_file), os.path.expanduser(dot_kis)) # endif if not args.__dict__['sfile']: print( '--sfile is required !! It should be one of supported types : {}'. format(invs_parsers.populate_sec_list(None))) sys.exit(-1) # endif if not args.__dict__['ptok']: print('--ptok is required !!') sys.exit(-1) # endif if not args.__dict__['odir']: print('--odir is required !!') sys.exit(-1) # endif # Vars kis_db_f = os.path.expanduser(kis_db_file) sec_file = args.__dict__['sfile'] kis_res = args.__dict__['res']
sys.exit(-1) # endif else: print('Using {} as Investing.com database file.'.format( args.__dict__["invs"])) invs_db_file = args.__dict__["invs"] # Copy the passed file to dot_invs_py print('Copying {} to {} ..'.format(invs_db_file, dot_invs_py)) shutil.copyfile(os.path.expanduser(invs_db_file), os.path.expanduser(dot_invs_py)) # endif if not args.__dict__["sfile"]: print( "--sfile is required !! It should be one of supported types : {}". format(invs_parsers.populate_sec_list(None))) sys.exit(-1) # endif if args.__dict__["strategy"] not in strategy_l: print('--strategy should be one of following : {}'.format(strategy_l)) sys.exit(-1) # endif strategy_type = args.__dict__["strategy"] strategy_name = args.__dict__["strategy_name"] # Vars invs_db_f = os.path.expanduser(invs_db_file) sec_file = args.__dict__["sfile"] ma_lag = args.__dict__["lag"] res = args.__dict__["res"]
args = parser.parse_args() if args.__dict__['sfile'] == None: print('--sfile required !!') sys.exit(-1) # endif suff_list = args.__dict__['suffix'].split( ',') if args.__dict__['suffix'] else [''] out_file = invs_utils.rp(args.__dict__['ofile']) sec_file = invs_utils.rp(args.__dict__['sfile']) ofile_hdr = 'Symbols' ofile_ftr = 'ColumnList\n1,0,94;1,3,69;1,4,64;1,5,58;1,6,64;1,7,63;0,8,100;1,9,64;1,10,61;1,11,64;1,12,65;1,1,67;1,13,63;1,14,68;0,15,100;0,16,100;0,17,100;0,18,100;1,19,67;1,20,67;0,21,100;0,22,100;0,23,100;0,24,100;0,25,100;0,26,100;0,27,100;0,28,100;0,29,100;0,30,100;0,31,100;0,32,100;1,33,100;1,34,83;1,2,100;\nCharts' sec_list = invs_parsers.populate_sec_list(sec_file) code_list = [] for sec_t in sec_list: for suffx_t in suff_list: code_list.append(sec_t['code'] + suffx_t) # endfor # endfor # Write to workspace file print('Writing to {}'.format(out_file)) with open(out_file, 'w') as ofile_hndl: ofile_hndl.write(ofile_hdr) ofile_hndl.write('\n') ofile_hndl.write('\n'.join(code_list)) ofile_hndl.write('\n')