def create_previous_state_array(btestmode,sym,barnum): indlist = partindlist durlist = barlistRecent currentstates =[] last1minbar = rpInd.ShowABarofInd(sym,'1min','mcross',barnum) timeofbar = last1minbar[0] ## print timeofbar for dur in durlist: for ind in indlist: lastbar = rpInd.ShowABarofIndByTime(sym,dur,ind,timeofbar,barnum) currentstates.append(lastbar) return currentstates,timeofbar
def create_previous_state_array(btestmode, sym, barnum, backtestdur): durlist = barlist_Recent currentstates = [] last1minbar = rpInd.ShowABarofInd( sym, backtestdur, 'mcross', barnum) ## was 1min ### this controls the backtester!! timeofbar = last1minbar[0] for dur in durlist: for ind in indlist: lastbar = rpInd.ShowABarofIndByTime(sym, dur, ind, timeofbar, barnum) currentstates.append(lastbar) return currentstates, timeofbar
def create_previous_state_array(sym, barnum): indlist = ['mcross', 'stochD', 'kupper'] durlist = ['1min', '3mins', '5mins', '15mins'] currentstates = [] last1minbar = rpInd.ShowABarofInd(sym, '1min', 'mcross', barnum) ## print last1minbar timeofbar = last1minbar[0] print timeofbar for dur in durlist: for ind in indlist: lastbar = rpInd.ShowABarofIndByTime(sym, dur, ind, timeofbar) currentstates.append(lastbar) return currentstates
def create_previous_state_array(btestmode, sym, barnum): durlist = barlist_Recent currentstates = [] last1minbar = rpInd.ShowABarofInd(sym, '15mins', 'mcross', barnum) ## was 1min timeofbar = last1minbar[0] ## print timeofbar for dur in durlist: ## print dur for ind in indlist: ## print ind,dur lastbar = rpInd.ShowABarofIndByTime(sym, dur, ind, timeofbar, barnum) ## print lastbar currentstates.append(lastbar) return currentstates, timeofbar
mlist = glob.glob(DataDown + 'dir*') for ma in mlist: month = ma[16:] newstatearea = statearea + 'statedir' + month newstateareaslash = newstatearea + '/' ensure_dir(newstatearea) f = newstateareaslash + 'ES.' + dur + '.mcross.state.csv' fileoutname = newstateareaslash + sym + '.' + dur + '.multiinds.state.csv' farray = rpu_rp.CsvToLines(f) line = [] fullarr = [] for l in farray: t = l[0] indlist = indlist_part #['RSI','ROC'] for ind in indlist: l.append(ind) l.append(rpInd.ShowABarofIndByTime(sym, dur, ind, t, 555555)[1]) l.append(rpInd.ShowABarofIndByTime(sym, dur, ind, t, 555555)[3]) print t, dur fullarr.append(l) rpu_rp.WriteArrayToCsvfile(fileoutname + 'news', fullarr) ########start_path = DataDown +'dir201601/' ########for sym in symlist: ######## for dur in durlist: ######## secs = secdict[dur] ######## barfileout = DataDown + '20161233.' + sym +'.' + dur+'.ddload.csv' #'blalines.csv' ######## get_dload_barsWbu(start_path,dur,barfileout,sym)