import rCodeGen, utility import attribute import aGenForE parser = argparse.ArgumentParser(description='This program will get results for all the subexperiments. \n' , formatter_class=argparse.RawTextHelpFormatter) parser.add_argument('-td', required=True,help='Training directory') parser.add_argument('-dt',required=True,help='Number of days after start training day specified . Defaults to 1 ') parser.add_argument('-run', required=True,help='dry (only show dont execute) or real (show and execute)') parser.add_argument('-sequence', required=True,help='lp (Local parallel) / dp (Distributed parallel) / serial') parser.add_argument('-nComputers',required=True,help="Number of computers at which task has to be run present in the data set") parser.add_argument('-iT',required=False,help='Instrument name') parser.add_argument('-sP',required=False,help='Strike price of instrument') parser.add_argument('-oT',required=False,help='Options Type') args = parser.parse_args() attribute.initializeInstDetails(args.iT,args.sP,args.oT) if(args.sequence == "dp"): import dp allDataDirectories = attribute.getListOfTrainingDirectoriesNames( int(args.dt) , args.td ,args.iT) commandList = [] for directories in allDataDirectories: #src/removeDuplicatesFromOrderBook.py -d ob/data/ro/nsefut/20141126/ -iT SBIN -oT 0 -sP -1 commandList.append(["removeDuplicatesFromOrderBook.py", "-d", directories, "-iT", args.iT, "-oT", args.oT, "-sP", args.sP]) for chunkNum in range(0,len(commandList),int(args.nComputers)): lSubGenList = commandList[chunkNum:chunkNum+int(args.nComputers)] utility.runCommandList(lSubGenList,args) print dp.printGroupStatus()
lListOfTrainPredictDirectories = lListOfTrainingDirectories if args.pd is None: predictionDirectory = attribute.getListOfTrainingDirectoriesNames(2,lListOfTrainPredictDirectories[-1],args.iT)[-1] else: predictionDirectory = args.pd lListOfTrainPredictDirectories.append(predictionDirectory) if(args.sequence == "dp"): experimentFolder = args.e dataFolder = args.td generatorsFolder = args.g commandList = [] for directories in lListOfTrainPredictDirectories: commandList.append(["aGenForE.py","-e",experimentFolder,"-d",directories,"-g",args.g,"-run",args.run,"-sequence",args.sequence,'-tickSize',args.tickSize,"-iT",args.iT,"-oT",args.oT,"-sP",args.sP]) utility.runCommandList( commandList ,args) print dp.printGroupStatus() else: if args.sequence == 'lp': # to run it in local parallel mode pool = multiprocessing.Pool() # this will return the number of CPU's results = map(scriptWrapperForFeatureGeneration,lListOfTrainPredictDirectories) else: results = map(scriptWrapperForFeatureGeneration,lListOfTrainPredictDirectories) utility.runCommand(["rGenForE.py","-e",args.e,"-a",algo,"-sequence",args.sequence,"-targetClass",args.targetClass,"-skipM",args.skipM,\ '-dt',args.dt,'-pd',predictionDirectory,"-td",args.td,"-skipP",args.skipP, '-wt' , args.wt,"-iT",args.iT,"-oT",args.oT,"-sP",args.sP],args.run,args.sequence) utility.runCommand(["runAllRScriptsForE.py","-td",args.td,"-pd",predictionDirectory,"-dt",args.dt,"-e",args.e,"-a",algo,"-run",args.run,\ '-wt' , args.wt,"-iT",args.iT,"-oT",args.oT,"-sP",args.sP,"-sequence",args.sequence],args.run,args.sequence) if args.targetClass == "multinomial" : utility.runCommand(["cMatrixGen.py","-d",predictionDirectory,"-e",args.e,"-a",algo],args.run,args.sequence)
if args.dt == None: args.dt = "1" if args.wt == None: args.wt = "default" if args.pd == None: args.pd = args.td if args.pdt == None: args.pdt = args.nDays if args.g == None: args.g = "ob/generators/" if args.targetClass == None: args.targetClass = "binomial" if args.iT is not None and args.sP is None and args.oT is None: args.sP = "-1" args.oT = "0" if "/nsecur/" in args.td: if args.t == None: args.t = "0.000015" if args.tickSize == None: args.tickSize = "25000" elif "/nsefut/" in args.td: if args.t == None: args.t = "0.00015" if args.tickSize == None: args.tickSize = "5" dp.printGroupStatus()