option = option1 + " Price" if (filetype == "A"): fileloc = "/space/data/new/PLUSTICK_1619_" + date + ".txt" if (filetype == "B"): fileloc = "/space/data/new/PLUSTICK_FI_1356_" + date + ".txt" if (filetype == "C"): fileloc = "/space/data/new/PLUSTICK_FUTURES_666_" + date + ".txt" if (filetype == "D"): fileloc = "/space/data/new/PLUSTICK_FUTURES_680_" + date + ".txt" df = pf.get_tickerData(fileloc, filetype, ticker, option2) except IndexError: print("Type 'list' to get a list of valid inputs") filetype = pf.get_validInput("Type A or B or C or D files: ", 4) date = pf.get_validInput("Enter Date in yyyymmdd: ", 0, filetype=filetype) ticker = pf.get_validInput("Enter One Ticker: ", 1) ticker = ticker[0] while True: option1 = input("Enter Trade, Bid, or Ask: ") if (option1 in ["Trade", "Bid", "Ask"]): if (option1 == "Trade"): option2 = "T" else: option2 = "Q" break else: print("Invalid Input") if (filetype == "A"):
image_width=1024, image_height=768, auto_open=False, show_link=False) print("Ticker", ticker, "at date", date, "done") print(date, "plots finished in", time() - init_tm, "seconds") ################### ## Main Function ## ################### if __name__ == "__main__": filetype = pf.get_validInput("Type A or B files: ", 4) while True: quotetype = input("Enter Bid or Ask: ") if (quotetype in ["Bid", "Ask"]): break print("Invalid Input") os.chdir("/space/mth693/common/phase1_alloutput/") program_start_tm = time() with mp.Pool(mp.cpu_count()) as pool: pool.starmap( program5a, zip(projLists.file_list, repeat(filetype), repeat(quotetype))) print("Program finished in", (time() - program_start_tm) / 60, "minutes")
# ################## # # Main Function ## # ################## if __name__ == "__main__": try: filetype1 = sys.argv[1] filetype2 = sys.argv[2] date = sys.argv[3] ticker = sys.argv[4] #option = sys.argv[4] except IndexError: print("Program 6: Plot Spread") print("Type 'list' to get a list of valid inputs") filetype1 = pf.get_validInput("Type A or B files: ", 4) filetype2 = pf.get_validInput("Type C or D files: ", 4) date = pf.get_validInput("Enter Date in yyyymmdd: ", 0, filetype=filetype2) ticker = pf.get_validInput("Enter F2:XBT or F2:BTC +\?19 Ticker: ", 1) ticker = ticker[0] #while True: # option = input("Enter 'plotly' or 'matplotlib':") # if (option in ['plotly', 'matplotlib']): # break # else: # print("Invalid option") if (filetype1 == "A"):
# ################## # # Main Function ## # ################## # + if __name__ == "__main__": #try: #filetype = sys.argv[1] #date = sys.argv[3] #ticker = sys.argv[4] #option = sys.argv[4] #except IndexError: #print("Program 2: Plot Trade Prices (aggregated)") #print("Type 'list' to get a list of valid inputs") filetype = pf.get_validInput("Type C or D files: ", 4) #date = pf.get_validInput("Enter Date in yyyymmdd: ", 0, # filetype=filetype) #ticker = pf.get_validInput("Enter F2:XBT or F2:BTC +\?19 Ticker: ", 1) #ticker = ticker[0] if (filetype == "A"): projLists.file_list = sorted(glob("/space/data/new/PLUSTICK_1619_*")) if (filetype == "B"): projLists.file_list = sorted( glob("/space/data/new/PLUSTICK_FI_1356_*")) if (filetype == "C"): projLists.file_list = sorted( glob("/space/data/new/PLUSTICK_FUTURES_666_*")) tickers = ["F2:XBT\F19", "F2:XBT\G19", "F2:XBT\J19", "F2:XBT\H19"] if (filetype == "D"):
''' ################### ## Main Function ## ################### if __name__ == "__main__": fileloc = "output/program1_out_A_20180404.txt" # Determine file type from file name fsplit = fileloc.split('_') if ("A" in fsplit): filetype = "A" else: filetype = "B" ticker = pf.get_validInput("Enter One Ticker: ", 1, ascii_art=True) ticker = ticker[0] # User should be careful. No error checking date = input("Enter Date: ") tm = input("Enter time") # Get unix timestamp from date and time unixtm = pf.time2unix(date, tm) # Get df from file with open(fileloc, 'r') as finput: pf.go_to_ticker(finput, ticker) print("Getting df from output...") init_tm = time() trades, quotes = pf.get_twoDFs(finput, filetype, unixtm=unixtm)
set_numbers(dft, dfq, df, tcols, qcols, size, ticker,region,contributors) l = list(set(contributors)) l.extend(list(set(region))) l = ["ALL"] + l for i in range(len(l)): col.append("Q-"+l[i]) col.append("T-"+l[i]) col.append("V-"+l[i]) df = df[col] return df if __name__ == "__main__": try: filetype, date = sys.argv[1], sys.argv[2] except IndexError: filetype = pf.get_validInput("Type A or B files: ", 4) date = pf.get_validInput("Enter Date in yyyymmdd: ", 0, filetype=filetype) if (filetype == "A"): fileloc = "/space/crypto/PLUSTICK_1619_" + date + ".txt" else: fileloc = "/space/crypto/PLUSTICK_FI_1356_" + date + ".txt" os.chdir(str(pathlib.Path.home()) + "/workspace/") dirpath = "phase1_output/program4_out/" + filetype + "/" pathlib.Path(dirpath).mkdir(parents=True, exist_ok=True) init_tm = time() df = qtvcounts(fileloc, filetype) df.to_csv(dirpath + "program4_out_" + filetype + "_" + date + ".csv")
# ################## # # Main Function ## # ################## if __name__ == "__main__": try: filetype1 = sys.argv[1] filetype2 = sys.argv[2] #date = sys.argv[3] ticker = sys.argv[3] #option = sys.argv[4] except IndexError: print("Program 2: Plot Trade Prices (aggregated)") print("Type 'list' to get a list of valid inputs") filetype1 = pf.get_validInput("Type A or B files: ", 4) filetype2 = pf.get_validInput("Type C or D files: ", 4) #date = pf.get_validInput("Enter Date in yyyymmdd: ", 0, # filetype=filetype2) ticker = pf.get_validInput("Enter F2:XBT or F2:BTC +\?19 Ticker: ", 1) ticker = ticker[0] while True: option = input("Enter 'plotly' or 'matplotlib':") if (option in ['plotly', 'matplotlib']): break else: print("Invalid option") #if (filetype1 == "A"): # fileloc1 = "/space/data/new/PLUSTICK_1619_" + date + ".txt"